test(General): implement unit test for serializer
This commit is contained in:
@@ -18,7 +18,7 @@ def bytes_to_long(b: bytes) -> int:
|
||||
def read_long(bis: BytesIO) -> int:
|
||||
try:
|
||||
return struct.unpack("q", bis.read(8))[0]
|
||||
except IOError:
|
||||
except struct.error:
|
||||
return 0
|
||||
|
||||
|
||||
@@ -51,7 +51,10 @@ def csv_as_list(input_str: str) -> List[str]:
|
||||
|
||||
|
||||
def add_to_map(map_: Dict[str, List[str]], token: str) -> None:
|
||||
eq_idx = token.index("=")
|
||||
try:
|
||||
eq_idx = token.index("=")
|
||||
except ValueError:
|
||||
eq_idx = -1 # set to -1 when not found
|
||||
if eq_idx > 0:
|
||||
key = token[:eq_idx]
|
||||
map_[key] = csv_as_list(token[eq_idx + 1 :])
|
||||
|
||||
Reference in New Issue
Block a user