12
12
13
13
# %% ../nbs/00_test.ipynb 6
14
14
def test_fail (f , msg = '' , contains = '' , args = None , kwargs = None ):
15
- args , kwargs = args or [], kwargs or {}
16
15
"Fails with `msg` unless `f()` raises an exception and (optionally) has `contains` in `e.args`"
16
+ args , kwargs = args or [], kwargs or {}
17
17
try : f (* args , ** kwargs )
18
18
except Exception as e :
19
19
assert not contains or contains in str (e )
20
20
return
21
21
assert False ,f"Expected exception but none raised. { msg } "
22
22
23
23
# %% ../nbs/00_test.ipynb 10
24
- def test (a , b , cmp ,cname = None ):
24
+ def test (a , b , cmp , cname = None ):
25
25
"`assert` that `cmp(a,b)`; display inputs and `cname or cmp.__name__` if it fails"
26
26
if cname is None : cname = cmp .__name__
27
27
assert cmp (a ,b ),f"{ cname } :\n { a } \n { b } "
@@ -34,7 +34,7 @@ def nequals(a,b):
34
34
# %% ../nbs/00_test.ipynb 20
35
35
def test_eq (a ,b ):
36
36
"`test` that `a==b`"
37
- test (a ,b ,equals , '==' )
37
+ test (a ,b ,equals , cname = '==' )
38
38
39
39
# %% ../nbs/00_test.ipynb 25
40
40
def test_eq_type (a ,b ):
0 commit comments