testing¶
Extensions of the unittest
module.
-
nutils.testing.
parametrize
(TestCase)¶ Parametrize a
unittest.TestCase
.>>> @parametrize ... class TestSomething(unittest.TestCase): ... def test_equality(self): ... self.assertEqual(self.x, self.y) >>> TestSomething(x=1, y=1) >>> TestSomething(x=2, y=2)
-
class
nutils.testing.
TestCase
(methodName='runTest')¶ Bases:
unittest.case.TestCase
A class whose instances are single test cases.
-
assertAlmostEqual64
(self, actual, desired, atol=2e-15, rtol=0.002)¶ Assert numerical equivalence with packed data.
Test closeness of
actual
todesired
data, where the latter are specified as a base64 packed data string (seenutils.numeric.pack()
andnutils.numeric.unpack()
for details on packing). The primary use case is embedded regression testing.The
atol
andrtol
arguments are used for both unpacking and equivalence testing and cannot be changed independently of the base64 string. Doing so will raise an exception with a suggested update.
-
-
nutils.testing.
ContextTestCase
¶ alias of
nutils.testing.TestCase