nerdocs / pydifact

A python EDIFACT library.
MIT License
156 stars 45 forks source link

Fix: Interchange with extra header elements #60

Closed mj0nez closed 1 year ago

mj0nez commented 1 year ago

This PR applies a fix for parsing an interchange with extra header elements. Currently, any extra element is lost.

def test_interchange_with_extra_header_elements():
    edi_str = (
        "UNB+UNOC:3+9901011000001:500+9900222000002:500+230314:1015+333333333++TL'"
        "UNH+42z42+PAORES:93:1:IA'"
        "UNT+2+42z42'"
        "UNZ+1+333333333'"
    )
    i = Interchange.from_str(edi_str)
    assert i.get_header_segment() == Segment(
        "UNB",
        ["UNOC", "3"],
        ["9901011000001", "500"],
        ["9900222000002", "500"],
        ["230314", "1015"],
        "333333333",
        "",
        "TL",
    )
mj0nez commented 1 year ago

@nerdoc, any chance you can review this and #58 ? :)

nerdoc commented 1 year ago

Looks good to me.

Newspaperman57 commented 9 months ago

Hi, i am also affected by this. It looks like it just missed 0.1.6, when is the next release scheduled? :)