diff --git a/hl7/parser.py b/hl7/parser.py index b985a54..ae1051a 100644 --- a/hl7/parser.py +++ b/hl7/parser.py @@ -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)]) diff --git a/tests/test_parse.py b/tests/test_parse.py index 7efda9a..39cc786 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -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])