Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    def test_create_with_segments(self):

        message = Message.from_segments([Segment("36CF")])
        self.assertEqual([
            Segment("36CF"),
        ], message.segments)
Exemplo n.º 4
0
 def test_serialize(self):
     message = Message.from_segments(
         [Segment("36CF", "1"), Segment("36CF", "2")])
     string = str(message)
     self.assertEqual("36CF+1'36CF+2'", string)