- class SymforceTestCaseMixin(methodName='runTest')#
Mixin for SymForce tests, adds useful helpers for code generation
methodName (str) –
- KEEP_PATHS = ['.*/__pycache__/.*', '.*\\.pyc']#
- static main(*args, **kwargs)#
Call this to run all tests in scope.
- static assertStorageNear(actual, desired, *, places=7, msg='', verbose=True)#
Check that two elements are close. Handles sequences, scalars, and geometry types using StorageOps.
- static assertLieGroupNear(actual, desired, *, places=7, msg='', verbose=True)#
Check that two LieGroup elements are close.
- static assertArrayEqual(actual, desired, msg='')#
Called by unittest base class when comparing ndarrays when “assertEqual” is called. By default, “assertEqual” uses the “==” operator, which is not implemented for ndarrays.
- assertNotEqual(first, second, msg='')#
Overrides unittest.assertNotEqual to handle ndarrays separately. “assertNotEqual” uses the “!=” operator, but this is not implemented for ndarrays. Instead, we check that np.testing.assert_array_equal raises an assertion error, as numpy testing does not provide a assert_array_not_equal function.
Note that assertNotEqual does not work like assertEqual in unittest. Rather than allowing you to register a custom equality evaluator (e.g. with
addTypeEqualityFunc()), assertNotEqual assumes the “!=” can be used with the arguments regardless of type.
- make_output_dir(prefix, directory=PosixPath('/tmp'))#
Create a temporary output directory, which will be automatically removed (regardless of exceptions) on shutdown, unless logger.level is DEBUG
Creates list of temporary directories that will be removed before shutdown (unless debug mode is on)
- Return type:
Removes temporary output directories (unless debug mode is on)
- Return type:
- compare_or_update(path, data)#
Compare the given data to what is saved in path, OR update the saved data if the
--updateflag was passed to the test.
- compare_or_update_file(path, new_file)#