teddecor.UnitTest.sample_test_file

 1from teddecor.UnitTest import *
 2
 3
 4class NonTestClass:
 5    pass
 6
 7
 8class IsTestClass(Test):
 9    @test
10    def example(self):
11        pass
12
13
14def NonTestFunc():
15    pass
16
17
18@test
19def IsTestFunc():
20    pass
class NonTestClass:
5class NonTestClass:
6    pass
NonTestClass()
class IsTestClass(teddecor.UnitTest.Testing.Test):
 9class IsTestClass(Test):
10    @test
11    def example(self):
12        pass

Class used to indentify and run tests. It will also print the results to the screen.

IsTestClass()
def example(*args, **kwargs)
 86    def test_wrapper(*args, **kwargs):
 87        """Executes the function this decorator is on and collect the run results.
 88
 89        Returns:
 90            tuple: The test run results. Formatted in the order of function name, type of result, and addition info.
 91
 92        Note:
 93            In the case of a skip and failed result the info portion is filled it with the type of skip and the traceback respectivily.
 94        """
 95        try:
 96            func(*args, **kwargs)
 97        except AssertionError as error:
 98            return (func.__name__, ResultType.FAILED, __getTracback(error))
 99        except NotImplementedError:
100            return (func.__name__, ResultType.SKIPPED, "")
101
102        return (func.__name__, ResultType.SUCCESS, "")

Executes the function this decorator is on and collect the run results.

Returns: tuple: The test run results. Formatted in the order of function name, type of result, and addition info.

Note: In the case of a skip and failed result the info portion is filled it with the type of skip and the traceback respectivily.

def NonTestFunc()
15def NonTestFunc():
16    pass