Skip to main content

Mojo function

assert_is

assert_is[T: Stringable & Identifiable](lhs: T, rhs: T, msg: String = __init__[__mlir_type.!kgen.string](""), *, location: Optional[_SourceLocation] = Optional(None))

Asserts that the input values have the same identity. If they do not then an Error is raised.

Parameters:

  • T (Stringable & Identifiable): A Stringable and Identifiable type.

Args:

  • lhs (T): The lhs of the is statement.
  • rhs (T): The rhs of the is statement.
  • msg (String): The message to be printed if the assertion fails.
  • location (Optional[_SourceLocation]): The location of the error (defaults to __call_location).

Raises:

An Error with the provided message if assert fails and None otherwise.

Was this page helpful?