mlair.helpers.testing

Helper functions that are used to simplify testing.

Module Contents

Classes

PyTestRegex

Assert that a given string meets some expectations.

Functions

PyTestAllEqual(check_list: List)

get_all_args(*args, remove=None, add=None)

check_nested_equality(obj1, obj2, precision=None, skip_args=None)

Check for equality in nested structures. Use precision to indicate number of decimals to check for consistency

class mlair.helpers.testing.PyTestRegex(pattern: Union[str, Pattern], flags: int = 0)

Assert that a given string meets some expectations.

Use like

>>> PyTestRegex(r"TestString\d+") == "TestString"
False
>>> PyTestRegex(r"TestString\d+") == "TestString2"
True
Parameters
  • pattern – pattern or string to use for regular expresssion

  • flags – python re flags

__eq__(self, actual: str)bool

Return whether regex matches given string actual or not.

__repr__(self)str

Show regex pattern.

mlair.helpers.testing.PyTestAllEqual(check_list: List)
mlair.helpers.testing.get_all_args(*args, remove=None, add=None)
mlair.helpers.testing.check_nested_equality(obj1, obj2, precision=None, skip_args=None)

Check for equality in nested structures. Use precision to indicate number of decimals to check for consistency