示例#1
0
 def toEdi(self):
     assert (self.tag is not None)
     message = PMessage()
     tag, elements = self.tag, self.toList()
     segment = PSegment(tag, None)
     if elements is not None and len(elements) > 0:
         segment = PSegment(tag, *elements)
     message.add_segment(segment)
     return message.serialize()
示例#2
0
def test_empty_segment():
    m = Message()
    with pytest.raises(ValueError):
        m.add_segment(Segment("", []))
示例#3
0
def test_UNA_integrity2():
    m = Message()
    initstring = ":+.? '"
    m.add_segment(Segment("UNA", initstring))
    assert m.serialize() == "UNA" + initstring