Пример #1
0
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
    )
Пример #2
0
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
    )
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
def main():
    args = get_arguments()
    print(generate_diff(args.first_file, args.second_file, args.format))