def test_yaml_diff2(): with open("tests/fixtures/diff2.txt") as f: diff = f.read() assert ( generate_diff( "tests/fixtures/before2.yaml", "tests/fixtures/after2.yaml" ) == diff )
def test_flat_json_diff(): with open("tests/fixtures/flat_diff.txt") as f: diff = f.read() assert ( generate_diff( "tests/fixtures/flat_before.json", "tests/fixtures/flat_after.json" ) == diff )
def test_gendiff_json(path): with open(path / 'res_json.json') as f: expected = json.load(f) got = json.loads( generate_diff(path / 'before.json', path / 'after.json', 'json')) assert got == expected
def test_gendiff_plain(path): with open(path / 'res_plain.txt') as f: expected = f.read() got = generate_diff(path / 'before.json', path / 'after.json', 'plain') assert got == expected
def test_gendiff_stylish(path): with open(path / 'res_stylish.txt') as f: expected = f.read() got = generate_diff(path / 'before.json', path / 'after.json', 'stylish') assert got == expected
def main(): args = get_arguments() print(generate_diff(args.first_file, args.second_file, args.format))