fix!: set packet version to 0.7 by default

no more unknown version that could break things
This commit is contained in:
ChillerDragon 2023-06-09 10:36:24 +02:00
parent aef93ce88b
commit 59d0150ed2
2 changed files with 4 additions and 6 deletions

View file

@ -14,10 +14,8 @@ def test_pack_handmade_count_connless7() -> None:
packet2 = parse7(data) packet2 = parse7(data)
# TODO: this should not fail ideally assert packet.version == packet2.version
# the version fiels is set to unknown for one of them assert vars(packet.messages[0]) == vars(packet2.messages[0])
# other fields probably also missmatch
# assert vars(packet) == vars(packet2)
assert len(packet2.messages) == 1 assert len(packet2.messages) == 1
assert packet2.messages[0].message_name == 'connless.count' assert packet2.messages[0].message_name == 'connless.count'

View file

@ -192,8 +192,8 @@ class PacketHeader(PrettyPrint):
]) + self.token ]) + self.token
class TwPacket(PrettyPrint): class TwPacket(PrettyPrint):
def __init__(self) -> None: def __init__(self, version: str = '0.7') -> None:
self.version: str = 'unknown' self.version: str = version
self.payload_raw: bytes = b'' self.payload_raw: bytes = b''
self.payload_decompressed: bytes = b'' self.payload_decompressed: bytes = b''
self.header: Union[PacketHeader, PacketHeader6] = PacketHeader() self.header: Union[PacketHeader, PacketHeader6] = PacketHeader()