Skip to content

Commit 9301d02

Browse files
committed
test: add type assertions for decoded values in round trip consistency tests
1 parent 8886f26 commit 9301d02

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_numeric_detection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def test_octal_like_numbers_preserved_as_strings(self):
168168
data = {"value": val}
169169
encoded = encode(data)
170170
decoded = decode(encoded)
171+
# Assert it's a dict before trying to access
172+
assert isinstance(decoded, dict)
171173
# They should come back as strings
172174
assert decoded["value"] == val
173175
assert isinstance(decoded["value"], str)
@@ -181,6 +183,8 @@ def test_valid_numbers_preserved_as_numbers(self):
181183
data = {"value": num}
182184
encoded = encode(data)
183185
decoded = decode(encoded)
186+
# Assert it's a dict before trying to access
187+
assert isinstance(decoded, dict)
184188
# They should come back as numbers (with potential float/int conversion)
185189
assert decoded["value"] == num
186190
assert isinstance(decoded["value"], (int, float))

0 commit comments

Comments
 (0)