Test framework primitives.
builtins
operator0
functools0
contextlib0
enum0
FailureType0
The type of test failure that occurred.
FailureTypenever0
Test was not ran or the conclusion could not be integrated.
never = -4
FailureTypelimit0
Resource limit exceeded.
limit = -3
FailureTypeinterrupt0
Test was interrupted by administrator.
interrupt = -2
FailureTypeexplicit0
Test failure was directly concluded by the function.
explicit = -1
FailureTypenone
Test did not fail. The failure of passed or skipped tests.
none = 0
FailureTypeabsurdity0
Test contended absurdity.
absurdity = +1
FailureTypefault0
Fault detected or trapped during testing. Critical process signal(SIGSEGV), language exception, or even promoted application errors.
fault = +2
FailureTypedescriptions0
descriptions = (
"The test did not fail.", # none
"The test contended an absurdity.",
"The test could not be completed due to an exception or critical process signal.",
"The test function never ran or the conclusion could not be recognized.", # -4
"The test exceeded a harness imposed resource limit.", # -3, limit
"The test was interrupted by an administrator.", # -2, interrupt
"The test function directly concluded failure.", # -1, explicit
)
TestConclusion0
The possible results of a test.
TestConclusionfailed0
The test did not pass. An associated Failure should be non-zero describing what happened.
failed = -1
TestConclusionskipped
The test was identified as not being applicable to the execution context.
skipped = 0
TestConclusionpassed0
The test executed without failure.
passed = +1
TestConclusiondescriptions0
descriptions = (
"The test was skipped.",
"The test passed.",
"The test failed.",
)
TestConclusionnot_failure10%
not_failure(self)
TestControl
TestControl__init__0
__init__(self, message)
Conclude0
Control exception for concluding a test.
Conclude__init__0
__init__(self, conclusion, failure, message)
Absurdity0
Exception raised by Contention instances designating a failed assertion.
Absurdityoperator_names_mapping0
operator_names_mapping = {
'__eq__': '==',
'__ne__': '!=',
'__le__': '<=',
'__ge__': '>=',
'__mod__': 'is',
'__lshift__': '<<',
}
Absurdity__init__0
__init__(self, operator, former, latter)
Absurdity__str__0
__str__(self)
Absurdity__repr__10%
__repr__(self)
Contention0
Contentions are objects used by Test objects to provide assertions. Usually, contention instances are made by the true division operator of Test instances passed into unit test subjects.
import featurelib
def test_feature(test):
expectation = ...
test/expectation == featurelib.functionality()
True division, "/", is used as it has high operator precedance that allows assertion expresssions to be constructed using minimal syntax that lends to readable failure conditions.
All of the comparison operations are supported by Contention and are passed on to the operands being examined.
Contention__slots__0
__slots__ = ('_operand', '_inverse', '_storage')
Contention__init__0
__init__(self, object)
Contention_override0
_override = {
'__mod__' : ('is', lambda x,y: x is y)
}
Contention__enter__0
__enter__(self)
Contention__exit__185%
__exit__(self, typ, val, tb)
Contention__xor__0
__xor__(self, operand)
Contend that the operand raises the given exception when it is called.
test/Exception ^ (lambda: callabel())
Contention__lshift__0
__lshift__(self, operand)
Contend that the operand is contained by the object.
test/Container << operand
Test471%
An object that manages an individual test and its execution. Provides interfaces for constructing and checking Contention's using a simple syntax.
Test__slots__0
__slots__ = (
'function', 'identifier', 'exits',
'metrics', 'conclusion', 'failure',
'exception', 'traceback',
'_invert_contention',
)
TestClock0
Clock = system_time_clock
TestAbsurdity0
Absurdity = Absurdity
TestContention0
Contention = Contention
Testline10%
Test__init__0
__init__(self, identifier, function, *constraints)
Test_inverse0
_inverse(self)
Test_absurd0
_absurd(self, inverse, truth)
Testinvert0
Invert the next contention; absurdity is coherent and coherence is absurd.
Test__truediv__0
__truediv__(self, operand)
Test__rtruediv__0
__rtruediv__(self, operand)
Testisinstance0
isinstance(self, *args)
Testissubclass0
issubclass(self, *args)
Testitertimer0
itertimer(count, time, scale, cycle, identity, min, range)
Measure the relative performance of a loop's iterations.
TestitertimerParameters
cycleThe maximum number of iterations to perform within a cycle. Used to limit the effects of the scale factor.
Testtime0
time(self, callable, **kw)
Measure the relative performance of the given callable.
Testskip0
skip(self, condition)
Explicitly conclude that the test skipped when condition is True.
Testfail0
fail(self)
Explicitly conclude that the test failed.
Test_timeout10%
_timeout(self, *args)