Newer
Older
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
from os.path import isfile
import pytest
from b_asic import SFG, Output, load_structure, save_structure
class TestSaveStructures:
def test_save_sfg(self, large_operation_tree):
sfg = SFG(outputs=[Output(large_operation_tree)])
path = save_structure(sfg)
assert path is not None
assert isfile(path)
def test_load_sfg(self, large_operation_tree):
sfg = SFG(outputs=[Output(large_operation_tree)])
path = save_structure(sfg)
_sfg = load_structure(path)
assert isinstance(_sfg, SFG)
assert sfg.components == _sfg.components
def test_save_sfg_custom_path(self, large_operation_tree):
sfg = SFG(outputs=[Output(large_operation_tree)])
path = save_structure(sfg, path="structures/test")
assert path is not None
assert isfile(path)
def test_load_sfg_custom_path(self, large_operation_tree):
sfg = SFG(outputs=[Output(large_operation_tree)])
path = save_structure(sfg, path="structures/test")
_sfg = load_structure(path)
assert isinstance(_sfg, SFG)
assert sfg.components == _sfg.components