def test_parse_function_complete(): def dummy(): """ # Title Blah """ x = {'a': 1} old_result = "%(a)s" % x new_result = "{x.a}".format(x=x) assert old_result == new_result assert new_result == "1" # output example = parse_function(dummy) assert example.name == 'dummy' assert example.title == "Title" assert example.details == "Blah" assert example.setup == "x = {'a': 1}" assert example.old == '"%(a)s" % x' assert example.new == '"{x.a}".format(x=x)' assert example.output == "1"
def test_parse_function_complete(): example = parse_function(func_to_ast(dummy_long)) assert example.name == 'dummy_long' assert example.title == "Title" assert example.details == "Blah" assert example.setup == "x = {'a': 1}" assert example.old == "'%(a)s' % x" assert example.new == "'{x.a}'.format(x=x)" assert example.output == "1"
def test_parse_function_empty(): example = parse_function(func_to_ast(dummy_empty)) assert example.name == 'dummy_empty' assert example.title is None assert example.details is None assert example.setup == "pass" assert example.old == "" assert example.new == "" assert example.output == ""
def test_parse_function_minimal(): example = parse_function(func_to_ast(dummy_minimal)) assert example.name == 'dummy_minimal' assert example.title is None assert example.details is None assert example.setup == "" assert example.old == "" assert example.new == "'{}'.format(1)" assert example.output == "1"
def test_parse_function_complete(): example = parse_function(dummy_long) assert example.name == 'dummy_long' assert example.title == "Title" assert example.details == "Blah" assert example.setup == "x = {'a': 1}" assert example.old == '"%(a)s" % x' assert example.new == '"{x.a}".format(x=x)' assert example.output == "1"
def test_parse_function_empty(): def dummy(): pass example = parse_function(dummy) assert example.name == 'dummy' assert example.title is None assert example.details is None assert example.setup == "pass" assert example.old == "" assert example.new == "" assert example.output == ""
def test_parse_function_minimal(): def dummy(): new_result = "{}".format(1) assert new_result == "1" # output example = parse_function(dummy) assert example.name == 'dummy' assert example.title is None assert example.details is None assert example.setup == "" assert example.old == "" assert example.new == '"{}".format(1)' assert example.output == "1"
def test_parse_decorated(): example = parse_function(func_to_ast(dummy_decorated)) assert example.name == 'dummy_decorated' assert example.setup == 'pass'