Пример #1
0
def test_empty_segment():
    m = SegmentCollection()
    with pytest.raises(ValueError):
        m.add_segment(Segment("", []))
Пример #2
0
        "arrival_port":
        specified_values["arrival"],
        "arrival_datetime_estimated":
        arrival.strftime("%Y%m%d%H%M"),
        "arrival_datetime_scheduled":
        arrival.strftime("%Y%m%d%H%M"),
        "equipments":
        equipments,
        "consignments":
        generate_consignments(number_of_consignments, equipment_ids)
    }

    if generate_data_doser_template:
        # use strings for the data-doser template variables so the generated edi can be used as a template
        message_data['message_reference_number'] = '$msg_ref'
        message_data['send_date'] = '$send_date'
        message_data['send_time'] = '$send_time'
        message_data['means_of_transport'] = '$ship'
        message_data['interchangeControlReference'] = '$src_number'
        message_data['message_reference_number'] = '$msg_ref'

    message = SegmentCollection()
    add_headers(message, message_data)
    add_cargo_report_sender_info(message, message_data)
    add_details_of_transport_and_arrival(message, message_data)
    add_general_indicator(message, message_data)
    add_equipments(message, message_data)
    add_consigments(message, message_data)
    add_footer(message, message_data)
    print(message.serialize())
Пример #3
0
def test_get_segment_doesnt_exist():
    collection = SegmentCollection()
    segment = collection.get_segment("36CF")
    assert segment is None
Пример #4
0
def test_get_segments_doesnt_exist():
    collection = SegmentCollection()
    segments = list(collection.get_segments("36CF"))
    assert [] == segments
Пример #5
0
def test_empty_segment_list():
    m = SegmentCollection()
    assert m.serialize() == ""
Пример #6
0
def test_UNA_integrity2():
    m = SegmentCollection()
    initstring = ":+.? '"
    m.add_segment(Segment("UNA", initstring))
    assert m.serialize() == "UNA" + initstring
Пример #7
0
def test_empty_segment():
    m = SegmentCollection()
    m.add_segment(Segment("", []))
    assert m