def check(fn, args, expected_result, remaining_raise=False): signature = [int] * len(args) # for now graph, t = get_graph(fn, signature) remove_asserts(t, [graph]) assert contains_raise(graph) == remaining_raise check_graph(graph, args, expected_result, t) return t, graph
def test_simple_melting_away(): def fn(n): assert n >= 1 return n-1 graph, t = get_graph(fn, [int]) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} remove_asserts(t, [graph]) assert summary(graph) == {'int_ge': 1, 'debug_assert': 1, 'int_sub': 1} check_graph(graph, [1], 0, t)
def test_simple_melting_away(): def fn(n): assert n >= 1 return n - 1 graph, t = get_graph(fn, [int]) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} remove_asserts(t, [graph]) assert summary(graph) == {'int_ge': 1, 'debug_assert': 1, 'int_sub': 1} check_graph(graph, [1], 0, t)
def test_simple_melting_away(): def fn(n): assert n >= 1 return n-1 graph, t = get_graph(fn, [int]) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} remove_asserts(t, [graph]) assert summary(graph) == {'int_ge': 1, 'debug_assert': 1, 'int_sub': 1} check_graph(graph, [1], 0, t) from pypy.translator.backendopt.removenoops import remove_debug_assert remove_debug_assert(graph) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} from pypy.translator.simplify import transform_dead_op_vars transform_dead_op_vars(graph) assert summary(graph) == {'int_sub': 1}
def test_simple_melting_away(): def fn(n): assert n >= 1 return n - 1 graph, t = get_graph(fn, [int]) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} remove_asserts(t, [graph]) assert summary(graph) == {'int_ge': 1, 'debug_assert': 1, 'int_sub': 1} check_graph(graph, [1], 0, t) from pypy.translator.backendopt.removenoops import remove_debug_assert remove_debug_assert(graph) assert summary(graph) == {'int_ge': 1, 'int_sub': 1} from pypy.translator.simplify import transform_dead_op_vars transform_dead_op_vars(graph) assert summary(graph) == {'int_sub': 1}