Example #1
0
def test_wikipedia_file():
    message = Interchange.from_file("{}/wikipedia.edi".format(path))
    # make some checks
    assert message.get_header_segment() == Segment("UNB", ["IATB", "1"],
                                                   "6XPPC", "LHPPC",
                                                   ["940101", "0950"], "1")
    assert message.get_segment("IFT") == Segment("IFT", "3",
                                                 "XYZCOMPANY AVAILABILITY")
    assert message.get_segment("TVL") == Segment(
        "TVL", ["240493", "1000", "", "1220"], "FRA", "JFK", "DL", "400", "C")
Example #2
0
def test_invoice_file():
    message = Interchange.from_file("{}/invoice1.edi".format(path))
    # make some checks
    assert message.get_header_segment() == Segment(
        "UNB",
        ["UNOA", "1"],
        "01010000253001",
        "O0013000093SCHA-Z59",
        ["991006", "1902"],
        "PAYO0012101221",
    )
    assert message.get_segment("DTM") == Segment(
        "DTM", ["137", "199910060000", "102"])
    assert message.get_segment("NAD") == Segment(
        "NAD", "BT", ["VAUXHALL MOTORS LTD", "", "91"])
    assert message.get_segment("RFF") == Segment("RFF", ["VA", "382324067"])
Example #3
0
def performance_test_huge_message():
    """Performance test parsing a huge message"""
    collection = Interchange.from_file("tests/data/huge_file2.edi")
    assert collection
def test_from_file():
    with pytest.raises(FileNotFoundError):
        Interchange.from_file("/no/such/file")
Example #5
0
def test_message_with_colon_at_end():
    Interchange.from_file("tests/data/invoice_with_colon_at_end.edi")