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

test_CSDReader   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 18
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
B test_CSDReader() 0 15 6
A refcode_families() 0 3 1
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