def test_parse_plan(self): plan = hl7.create_parse_plan(sample_hl7) self.assertEqual(plan.separator, '\r') con = plan.container([1, 2]) self.assertTrue(isinstance(con, Message)) self.assertEqual(con, [1, 2]) self.assertEqual(con.separator, '\r')
def test_parse_plan_next(self): plan = hl7.create_parse_plan(sample_hl7) n1 = plan.next() self.assertEqual(n1.separators, ['|', '^']) self.assertEqual(n1.containers, [Segment, Field]) n2 = n1.next() self.assertEqual(n2.separators, ['^']) self.assertEqual(n2.containers, [Field]) n3 = n2.next() self.assertTrue(n3 is None)
def test_parse_plan_next(self): plan = hl7.create_parse_plan(sample_hl7) n1 = plan.next() self.assertEqual(n1.separators, ['|', '~', '^', '&']) self.assertEqual(n1.containers, [Segment, Field, Repetition, Component]) n2 = n1.next() self.assertEqual(n2.separators, ['~', '^', '&']) self.assertEqual(n2.containers, [Field, Repetition, Component]) n3 = n2.next() self.assertEqual(n3.separators, ['^', '&']) self.assertEqual(n3.containers, [Repetition, Component]) n4 = n3.next() self.assertEqual(n4.separators, ['&']) self.assertEqual(n4.containers, [Component]) n5 = n4.next() self.assertTrue(n5 is None)
def test_create_parse_plan(self): plan = hl7.create_parse_plan(sample_hl7) self.assertEqual(plan.separators, ['\r', '|', '^']) self.assertEqual(plan.containers, [Message, Segment, Field])
def test_create_parse_plan(self): plan = hl7.create_parse_plan(sample_hl7) self.assertEqual(plan.separators, ['\r', '|', '~', '^', '&']) self.assertEqual(plan.containers, [Message, Segment, Field, Repetition, Component])