def assert_statement_has_child_names_resolved(): _assert_children_resolved( lambda ref: nodes.assert_(ref), ) _assert_children_resolved( lambda ref: nodes.assert_(nodes.bool_literal(False), ref), )
def test_assert_without_message_is_transformed_to_conditional_raise(self): _assert_transform( nodes.assert_(nodes.ref("value")), """ if not value: raise $builtins.AssertionError.__call__("") """ )
def test_parse_assert_extended_form(): _assert_statement_parse( nodes.assert_(nodes.ref("x"), nodes.str_literal("Oops")), "assert x, 'Oops'" )
def test_parse_assert_simple_form(): _assert_statement_parse(nodes.assert_(nodes.ref("x")), "assert x")
def assert_condition_is_type_checked(): assert_expression_is_type_checked( lambda bad_expr: nodes.assert_(bad_expr) )
def assert_message_is_type_checked(): assert_expression_is_type_checked( lambda bad_expr: nodes.assert_(nodes.bool_literal(False), bad_expr) )