Update lispytest.py
This commit is contained in:
parent
192b0ec410
commit
68bda97dda
@ -104,11 +104,11 @@ def test(tests, name=''):
|
|||||||
for (x, expected) in tests:
|
for (x, expected) in tests:
|
||||||
try:
|
try:
|
||||||
result = eval(parse(x))
|
result = eval(parse(x))
|
||||||
print(x, '=>', to_string(result))
|
print(x, '=>', lispstr(result))
|
||||||
ok = (result == expected)
|
ok = (result == expected)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(x, '=raises=>', type(e).__name__, e)
|
print(x, '=raises=>', type(e).__name__, e)
|
||||||
ok = issubclass(expected, Exception) and isinstance(e, expected)
|
ok = isinstance(expected, type) and issubclass(expected, Exception) and isinstance(e, expected)
|
||||||
if not ok:
|
if not ok:
|
||||||
fails += 1
|
fails += 1
|
||||||
print('FAIL!!! Expected', expected)
|
print('FAIL!!! Expected', expected)
|
||||||
@ -116,7 +116,6 @@ def test(tests, name=''):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from lis import *
|
from lis import *
|
||||||
to_string = str
|
|
||||||
test(lis_tests, 'lis.py')
|
test(lis_tests, 'lis.py')
|
||||||
from lispy import *
|
from lispy import *
|
||||||
test(lis_tests+lispy_tests, 'lispy.py')
|
test(lis_tests+lispy_tests, 'lispy.py')
|
||||||
|
Loading…
Reference in New Issue
Block a user