def test_source_putaround(): source = Source() source = source.putaround(""" if 1: x=1 """) assert str(source).strip() == "if 1:\n x=1"
def test_source_putaround_simple(): source = Source("raise ValueError") source = source.putaround( "try:", """\ except ValueError: x = 42 else: x = 23""") assert str(source) == """\