Skip to content

Commit 68b417d

Browse files
committed
Nest the sender name into into its own component
1 parent 7181dd9 commit 68b417d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/senaite/astm/instruments/horiba_pentra_xlr.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ def get_mapping():
4444
class HeaderRecord(records.HeaderRecord):
4545
"""Message Header Record (H)
4646
"""
47-
sender = TextField(length=3)
47+
48+
# Note: Although the field comes in as a single value text, we need to nest
49+
# it for senaite.core.astm.consumer.get_sender_name to work properly
50+
sender = ComponentField(
51+
Component.build(
52+
TextField(name="name"),
53+
))
4854

4955
processing_id = SetField(
5056
field=TextField(),

src/senaite/astm/tests/test_pentra_xlr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_header_record(self):
7676
record = data["H"][0]
7777

7878
# test sender name
79-
self.assertEqual(record["sender"], "ABX")
79+
self.assertEqual(record["sender"]["name"].strip(), "ABX")
8080

8181
# test processing_id
8282
self.assertEqual(record["processing_id"], "P")

0 commit comments

Comments
 (0)