def METHOD_NAME(self, expr, shape: Tuple[int, ...]) -> None:
    """Asserts that expr is an Expression with dimension shape.
    """
    assert isinstance(expr, Expression) or isinstance(expr, Constraint)
    self.assertEqual(expr.shape, shape)