def test_unpacking_packing_header_with_length(): """ Test for header (with length) for packing and unpacking """ tested_header = Header(SegTag.IVT2, length=10) packed_header = tested_header.export() unpacked = tested_header.parse(packed_header) assert unpacked == tested_header
def test_comparision_header_without_length(): """Test for comparing header and header 2 (without lenght) for packing and unpacking""" tested_header2 = Header2(SegTag.IVT2) tested_header = Header(SegTag.IVT2) packed_header2 = tested_header2.export() packed_header = tested_header.export() unpacked2 = tested_header2.parse(packed_header2) unpacked = tested_header.parse(packed_header) assert unpacked2 != unpacked assert packed_header2 != packed_header
def test_basic_header_without_length(): """Basic test for header without length""" tested_header = Header(SegTag.IVT2) assert tested_header.tag == SegTag.IVT2 assert tested_header.param == 0 assert tested_header.length == tested_header.SIZE assert "Header" in repr(tested_header) output = tested_header.info() repr_strings = ["TAG", "PARAM", "LEN"] for req_string in repr_strings: assert req_string in output, f"string {req_string} is not in the output: {output}"
def test_basic_header_with_length(): """ Basic Test for header with length """ tested_header = Header(SegTag.IVT2, length=10) assert tested_header.tag == SegTag.IVT2 assert tested_header.param == 0 assert tested_header.length == 10