import argparse, unittest
from colorama import init, Fore, Back, Style
from pydifact.segmentcollection import SegmentCollection
collection = SegmentCollection.from_file(
    "G:\\GitHub\\desadv-validator\\tests\\DESADV_line_break.txt")
# collection = SegmentCollection.from_str("UNA:+,? 'UNH+1+ORDERS:D:96A:UN:EAN008'")

# for segment in collection.segments:
#     print('{}: {}'.format(segment.tag, segment.elements))

for each in collection.get_segments('RFF'):
    print(each)
print('----')
fail_msg = '[ ' + Fore.RED + '×' + Style.RESET_ALL + ' ] - '
success_msg = '[ ' + Fore.GREEN + '√' + Style.RESET_ALL + ' ] - '
info_msg = '[ ' + Fore.YELLOW + '●' + Style.RESET_ALL + ' ] - '
init(convert=True)
parser = argparse.ArgumentParser(description='Process some integers.')
group = parser.add_mutually_exclusive_group()

group.add_argument("-EH", help="Auswahl von EH, Standard", action="store_true")
group.add_argument("-GH", help="Auswahl von GH", action="store_true")
# parser.add_argument('-hs', '--handelsstufe', default='EH', choices=['EH', 'GH'], help='Zur Spezifikation der Handelsstufe (default: %(default)s)')
args = parser.parse_args()

if args.GH:
    print('GH')
else:
    print('EH')

unt_counter = 0
示例#2
0
def test_from_file():
    with pytest.raises(FileNotFoundError):
        SegmentCollection.from_file("/no/such/file")
示例#3
0
def load_edifact(edifact_filename):
    return SegmentCollection.from_file(edifact_filename)
示例#4
0
def performance_test_huge_message():
    """Performance test parsing a huge message"""
    collection = SegmentCollection.from_file("tests/data/huge_file2.edi")
    assert collection