Skip to main content
Log in

Mojo module

testing

Implements various testing utils.

You can import these APIs from the testing package. For example:

from testing import assert_true
from testing import assert_true

Structs

  • assert_raises: Context manager that asserts that the block raises an exception.

Traits

  • Testable: A trait that a struct should conform to if we do equality testing on it.

Functions

  • assert_almost_equal: Asserts that the input values are equal up to a tolerance. If it is not then an Error is raised.
  • assert_equal: Asserts that the input values are equal. If it is not then an Error is raised.
  • assert_false: Asserts that the input value is False and raises an Error if it's not.
  • assert_is: Asserts that the input values have the same identity. If they do not then an Error is raised.
  • assert_is_not: Asserts that the input values have different identities. If they do not then an Error is raised.
  • assert_not_equal: Asserts that the input values are not equal. If it is not then an Error is raised.
  • assert_true: Asserts that the input value is True and raises an Error if it's not.

Was this page helpful?