File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
21import logging
32
43import 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
You can’t perform that action at this time.
0 commit comments