MCPcopy Create free account
hub / github.com/numpy/numpy / exc_iter

Function exc_iter

numpy/core/tests/test_extint128.py:44–63  ·  view source on GitHub ↗

Iterate over Cartesian product of *args, and if an exception is raised, add information of the current iterate.

(*args)

Source from the content-addressed store, hash-verified

42
43@contextlib.contextmanager
44def exc_iter(*args):
45 """
46 Iterate over Cartesian product of *args, and if an exception is raised,
47 add information of the current iterate.
48 """
49
50 value = [None]
51
52 def iterate():
53 for v in itertools.product(*args):
54 value[0] = v
55 yield v
56
57 try:
58 yield iterate()
59 except Exception:
60 import traceback
61 msg = "At: %r\n%s" % (repr(value[0]),
62 traceback.format_exc())
63 raise AssertionError(msg)
64
65
66def test_safe_binop():

Callers 13

test_safe_binopFunction · 0.85
test_to_128Function · 0.85
test_to_64Function · 0.85
test_mul_64_64Function · 0.85
test_add_128Function · 0.85
test_sub_128Function · 0.85
test_neg_128Function · 0.85
test_shl_128Function · 0.85
test_shr_128Function · 0.85
test_gt_128Function · 0.85
test_divmod_128_64Function · 0.85
test_floordiv_128_64Function · 0.85

Calls 1

iterateFunction · 0.85

Tested by

no test coverage detected