-
Notifications
You must be signed in to change notification settings - Fork 10
/
test_find_parent.py
executable file
·54 lines (39 loc) · 1.65 KB
/
test_find_parent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
import pytest
from aiida.orm import load_node
from aiida_kkr.tools.find_parent import find_parent_structure, get_calc_from_remote
from ..conftest import import_with_migration
def test_find_parent_structure():
"""
find parent structure and Voronoi parent calculation from KKR calculation
"""
# load necessary files from db_dump files
import_with_migration('files/db_dump_kkrcalc.tar.gz')
kkr_calc = load_node('3058bd6c-de0b-400e-aff5-2331a5f5d566')
# now find voronoi parent and structure
struc, voro_parent = find_parent_structure(kkr_calc)
# check result
assert struc.uuid == 'e51ee6a1-bd27-4901-9612-7bac256bf117'
assert voro_parent.uuid == '559b9d9b-3525-402e-9b24-ecd8b801853c'
def test_find_structure_kkrimp():
"""
find parent structure from a KkrimpCalculation
"""
import_with_migration('files/db_dump_kkrimp_out.tar.gz')
kkrimp_calc = load_node('eab8db1b-2cc7-4b85-a524-0df4ff2b7da6')
# now find voronoi parent and structure
struc, voro_parent = find_parent_structure(kkrimp_calc)
# check result
assert struc.uuid == 'e51ee6a1-bd27-4901-9612-7bac256bf117'
assert voro_parent.uuid == '559b9d9b-3525-402e-9b24-ecd8b801853c'
def test_get_calc_from_remote():
"""
find parent calc from remote
"""
# load necessary files from db_dump files
import_with_migration('files/db_dump_kkrcalc.tar.gz')
kkr_calc = load_node('3058bd6c-de0b-400e-aff5-2331a5f5d566')
# now find voronoi parent and structure
parent_from_remote = get_calc_from_remote(kkr_calc.outputs.remote_folder)
# check result
assert parent_from_remote.uuid == kkr_calc.uuid