File: exceptions.py

package info (click to toggle)
python-testbook 0.4.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 408 kB
  • sloc: python: 1,045; makefile: 11
file content (41 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class TestbookError(Exception):
    """Generic Testbook exception class"""
    __test__ = False


class TestbookCellTagNotFoundError(TestbookError):
    """Raised when cell tag is not declared in notebook"""

    pass


class TestbookSerializeError(TestbookError):
    """Raised when output cannot be JSON serialized"""

    pass


class TestbookExecuteResultNotFoundError(TestbookError):
    """Raised when there is no execute_result"""

    pass


class TestbookAttributeError(AttributeError):
    __test__ = False


class TestbookRuntimeError(RuntimeError):
    __test__ = False

    def __init__(self, evalue, traceback, eclass=None):
        super().__init__(evalue)
        self.evalue = evalue
        self.traceback = traceback
        self.eclass = eclass

    def __str__(self):  # pragma: no cover
        return str(self.traceback)

    def __repr__(self):  # pragma: no cover
        return str(self.traceback)