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

Function assert_warn_len_equal

numpy/testing/tests/test_utils.py:1239–1259  ·  view source on GitHub ↗
(mod, n_in_context)

Source from the content-addressed store, hash-verified

1237
1238
1239def assert_warn_len_equal(mod, n_in_context):
1240 try:
1241 mod_warns = mod.__warningregistry__
1242 except AttributeError:
1243 # the lack of a __warningregistry__
1244 # attribute means that no warning has
1245 # occurred; this can be triggered in
1246 # a parallel test scenario, while in
1247 # a serial test scenario an initial
1248 # warning (and therefore the attribute)
1249 # are always created first
1250 mod_warns = {}
1251
1252 num_warns = len(mod_warns)
1253
1254 if 'version' in mod_warns:
1255 # Python 3 adds a 'version' entry to the registry,
1256 # do not count it.
1257 num_warns -= 1
1258
1259 assert_equal(num_warns, n_in_context)
1260
1261
1262def test_warn_len_equal_call_scenarios():

Calls 1

assert_equalFunction · 0.90

Tested by

no test coverage detected