Passed
Push — master ( 8b2ed0...4823d2 )
by Daniel
03:53
created

test_CSDReader.test_CSDReader()   B

Complexity

Conditions 6

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 15
rs 8.6666
c 0
b 0
f 0
cc 6
nop 2
1
import pytest
2
import amd
3
4
5
@pytest.fixture(scope='module')
6
def refcode_families():
7
    return ['DEBXIT', 'GLYCIN', 'HXACAN', 'ACSALA']
8
9
10
def test_CSDReader(reference_data, refcode_families):
11
12
    if not amd.io._CSD_PYTHON_API_ENABLED:
13
        pytest.skip(f'Skipping CSDReader test as csd-python-api is not installed.')
14
15
    references = reference_data['CSD_families']
16
    read_in = list(amd.CSDReader(refcode_families, show_warnings=False, families=True))
17
    
18
    if (not len(references) == len(read_in)) or len(read_in) == 0:
19
        pytest.fail(f'There are {len(references)} references, but {len(read_in)} structures were read.')
20
    
21
    for s, s_ in zip(read_in, references):
22
        print(s, s_)
23
        if not s == s_:
24
            pytest.fail(f'Structure {s.name} is different from reference.')
25