def test_get_segments(self): message = Message.from_segments( [Segment("36CF", 1), Segment("CPD"), Segment("36CF", 2)] ) segments = list(message.get_segments("36CF")) self.assertEqual([Segment("36CF", 1), Segment("36CF", 2)], segments)
def test_get_segment(self): message = Message.from_segments([ Segment("36CF", 1), Segment("36CF", 2), ]) segment = message.get_segment("36CF") self.assertEqual(Segment("36CF", 1), segment)
def test_create_with_segments(self): message = Message.from_segments([Segment("36CF")]) self.assertEqual([ Segment("36CF"), ], message.segments)
def test_serialize(self): message = Message.from_segments( [Segment("36CF", "1"), Segment("36CF", "2")]) string = str(message) self.assertEqual("36CF+1'36CF+2'", string)