Code Duplication    Length = 14-14 lines in 3 locations

tests/test_CifReader.py 3 locations

@@ 59-72 (lines=14) @@
56
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
57
58
59
def test_CifReader_ccdc(cif_paths, reference_data):
60
    for name in cif_paths:
61
        references = reference_data[name]
62
        try:
63
            read_in = list(amd.CifReader(cif_paths[name], reader='ccdc'))
64
        except ImportError as _:
65
            pytest.skip('Skipping ccdc reader test as ccdc is not installed.')
66
67
        if (not len(references) == len(read_in)) or len(read_in) == 0:
68
            pytest.fail(f'There are {len(references)} references, but {len(read_in)} structures were read.')
69
70
        for s, s_ in zip(read_in, references):
71
            if not s == s_['PeriodicSet']:
72
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
73
74
75
@pytest.fixture(scope='module')
@@ 43-56 (lines=14) @@
40
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
41
42
43
def test_CifReader_gemmi(cif_paths, reference_data):
44
    for name in cif_paths:
45
        references = reference_data[name]
46
        try:
47
            read_in = list(amd.CifReader(cif_paths[name], reader='gemmi'))
48
        except ImportError as _:
49
            pytest.skip('Skipping gemmi reader test as gemmi is not installed.')
50
51
        if (not len(references) == len(read_in)) or len(read_in) == 0:
52
            pytest.fail(f'There are {len(references)} references, but {len(read_in)} structures were read.')
53
54
        for s, s_ in zip(read_in, references):
55
            if not s == s_['PeriodicSet']:
56
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
57
58
59
def test_CifReader_ccdc(cif_paths, reference_data):
@@ 27-40 (lines=14) @@
24
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
25
26
27
def test_CifReader_pymatgen(cif_paths, reference_data):
28
    for name in cif_paths:
29
        references = reference_data[name]
30
        try:
31
            read_in = list(amd.CifReader(cif_paths[name], reader='pymatgen'))
32
        except ImportError as _:
33
            pytest.skip('Skipping pymatgen reader test as pymatgen is not installed.')
34
35
        if (not len(references) == len(read_in)) or len(read_in) == 0:
36
            pytest.fail(f'There are {len(references)} references, but {len(read_in)} structures were read.')
37
38
        for s, s_ in zip(read_in, references):
39
            if not s == s_['PeriodicSet']:
40
                pytest.fail(f'Structure {s.name} read with CifReader disagrees with reference.')
41
42
43
def test_CifReader_gemmi(cif_paths, reference_data):