Skip to content

Commit 6e87539

Browse files
committed
fix tests
1 parent ba381c9 commit 6e87539

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

unpythonic/syntax/tests/test_lazify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def my_if(p, a, b):
124124

125125
# test the laziness
126126
# note the raisef() calls; in regular Python, they'd run anyway before my_if() gets control.
127-
test[my_if(True, 23, raisef(RuntimeError, "I was evaluated!")) == 23]
128-
test[my_if(False, raisef(RuntimeError, "I was evaluated!"), 42) == 42]
127+
test[my_if(True, 23, raisef(RuntimeError("I was evaluated!"))) == 23]
128+
test[my_if(False, raisef(RuntimeError("I was evaluated!")), 42) == 42]
129129

130130
# In this example, the divisions by zero are never performed.
131131
test[my_if(True, 23, 1 / 0) == 23]

unpythonic/tests/test_conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def lowlevel():
4848
with restarts(use_value=(lambda x: x),
4949
double=(lambda x: 2 * x),
5050
drop=(lambda x: _drop),
51-
bail=(lambda x: raisef(ValueError, x))) as result:
51+
bail=(lambda x: raisef(ValueError(x)))) as result:
5252
# Let's pretend we only want to deal with even numbers.
5353
# Realistic errors would be something like nonexistent file, disk full, network down, ...
5454
if k % 2 == 1:

unpythonic/tests/test_it.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
from ..fun import composel, identity, curry
3434
from ..gmemo import imemoize, gmemoize
3535
from ..mathseq import s
36-
from ..misc import Popper, ulp
36+
from ..misc import Popper
37+
from ..numutil import ulp
3738

3839
def runtests():
3940
with testset("mapping and zipping"):

unpythonic/tests/test_mathseq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from ..it import take, last
1414
from ..fold import scanl
1515
from ..gmemo import imemoize
16-
from ..misc import timer, ulp
16+
from ..misc import timer
17+
from ..numutil import ulp
1718

1819
def runtests():
1920
with testset("sign (adapter, numeric and symbolic)"):

unpythonic/tests/test_misc.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ def mul3(a, b, c):
117117
except ValueError as err:
118118
test[err.__cause__ is exc] # cause specified, like `raise ... from ...`
119119

120-
# raisef with old-style parameters (as of v0.14.2, deprecated, will be dropped in v0.15.0)
121-
raise_instance = lambda: raisef(ValueError, "all ok")
122-
test_raises[ValueError, raise_instance()]
123-
124120
# can also raise an exception class (no instance)
125121
test_raises[StopIteration, raisef(StopIteration)]
126122

0 commit comments

Comments
 (0)