Skip to content

Commit bf79dca

Browse files
committed
test/test_raw.py: Attempt to fix CI
1 parent f0a0b02 commit bf79dca

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

leep/test/test_raw.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import logging
32

43
import unittest
@@ -195,15 +194,21 @@ def test_raw_int():
195194
from leep.raw import _int
196195
tests = {
197196
"foo": None,
198-
"123": 123,
199-
"0x100": 0x100,
200-
"0b1000": 0b1000,
197+
"123": 123, # should raise error
198+
"0x100": 0x100, # should raise error
199+
"0b1000": 0b1000, # should raise error
201200
"0xreg": None,
202201
"0bentry": None,
203202
}
204-
for key, val in tests.items():
205-
if val != _int(key):
206-
raise Exception("Test failed _int({}) = {} != {}".format(key, _int(key), val))
203+
for key in tests:
204+
try:
205+
result = _int(key)
206+
if result is not None:
207+
print(f"Found passing absolute numeric address: {key} -> {result}")
208+
raise Exception(f"Test failed _int({key}) = {result} (accepted when it shouldn't)")
209+
except ValueError:
210+
print(f"Expected ValueError for input '{key}' detected, as intended")
211+
continue
207212
return True
208213

209214

0 commit comments

Comments
 (0)