MCPcopy
hub / github.com/numpy/numpy / assert_

Function assert_

numpy/testing/_private/utils.py:114–131  ·  view source on GitHub ↗

Assert that works in release mode. Accepts callable msg to allow deferring evaluation until failure. The Python built-in ``assert`` does not work when executing code in optimized mode (the ``-O`` flag) - no byte-code is generated for it. For documentation on usage, refer to th

(val, msg='')

Source from the content-addressed store, hash-verified

112 == "1.79769313486231580793728971405301e+308")
113
114def assert_(val, msg=''):
115 """
116 Assert that works in release mode.
117 Accepts callable msg to allow deferring evaluation until failure.
118
119 The Python built-in ``assert`` does not work when executing code in
120 optimized mode (the ``-O`` flag) - no byte-code is generated for it.
121
122 For documentation on usage, refer to the Python documentation.
123
124 """
125 __tracebackhide__ = True # Hide traceback for py.test
126 if not val:
127 try:
128 smsg = msg()
129 except TypeError:
130 smsg = msg
131 raise AssertionError(smsg)
132
133
134if os.name == 'nt':

Callers 15

test_n_zeroMethod · 0.90
test_basicMethod · 0.90
test_gaussian_resetMethod · 0.90
test_in_bounds_fuzzMethod · 0.90
test_repeatabilityMethod · 0.90
test_vonmises_smallMethod · 0.90
test_vonmises_nanMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_n_zeroMethod · 0.72
test_basicMethod · 0.72
test_gaussian_resetMethod · 0.72
test_in_bounds_fuzzMethod · 0.72
test_repeatabilityMethod · 0.72
test_vonmises_smallMethod · 0.72
test_vonmises_nanMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…