Skip to content

Commit db056e1

Browse files
committed
Fix objects
1 parent f4a359f commit db056e1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
from bam_masterdata.datamodel.object_types import Instrument, Storage
1+
from bam_masterdata.datamodel.object_types import Instrument
22
from bam_masterdata.parsing import AbstractParser
33

44

55
class MasterdataParserExample(AbstractParser):
66
def parse(self, files, collection, logger):
7-
storage = Storage(
8-
name="Example Storage",
9-
storage_storage_validation_level="BOX",
7+
instrument_input = Instrument(
8+
name="Example Input Instrument",
9+
manufacturer="Example Manufacturer",
10+
bam_oe="OE_VP.1",
11+
bam_location_complete="UE_08_0_101",
1012
)
11-
storage_id = collection.add(storage)
12-
instrument = Instrument(
13-
name="Example Instrument",
13+
instrument_input_id = collection.add(instrument_input)
14+
instrument_output = Instrument(
15+
name="Example Output Instrument",
1416
manufacturer="Example Manufacturer",
1517
bam_oe="OE_VP.1",
1618
bam_location_complete="UE_08_0_101",
1719
)
18-
instrument_id = collection.add(instrument)
19-
_ = collection.add_relationship(storage_id, instrument_id)
20-
logger.info("Parsing finished: Added example chemical and instrument.")
20+
instrument_output_id = collection.add(instrument_output)
21+
_ = collection.add_relationship(instrument_input_id, instrument_output_id)
22+
logger.info(
23+
"Parsing finished: Added examples input and output instruments and their relation."
24+
)

tests/test_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ def test_parse(self, parser):
99

1010
assert len(collection.attached_objects) == 2
1111
objects = list(collection.attached_objects.values())
12-
assert objects[0].name == "Example Storage"
13-
assert objects[1].name == "Example Instrument"
12+
assert objects[0].name == "Example Input Instrument"
13+
assert objects[1].name == "Example Output Instrument"
1414
assert len(collection.relationships) == 1

0 commit comments

Comments
 (0)