Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hl7/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def create_parse_plan(strmsg, factory=Factory):
# Extract the rest of the separators. Defaults used if not present.
if strmsg[:3] not in ("MSH", "FHS", "BHS"):
raise ParseException(
"First segment is {}, must be one of MHS, FHS or BHS".format(strmsg[:3])
"First segment is {}, must be one of MSH, FHS or BHS".format(strmsg[:3])
)
sep0 = strmsg[3]
seps = list(strmsg[3 : strmsg.find(sep0, 4)])
Expand Down
5 changes: 5 additions & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,8 @@ def test_parse_plan_next(self):

n5 = n4.next()
self.assertTrue(n5 is None)

def test_create_parse_plan_invalid_segment(self):
with self.assertRaises(ParseException) as cm:
hl7.parser.create_parse_plan("PID|^~\\&|GHH LAB")
self.assertIn("must be one of MSH, FHS or BHS", cm.exception.args[0])
Loading