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()
def test_empty_segment_list(): m = Message() assert m.serialize() == ""
def test_UNA_integrity2(): m = Message() initstring = ":+.? '" m.add_segment(Segment("UNA", initstring)) assert m.serialize() == "UNA" + initstring