MCPcopy Index your code
hub / github.com/numpy/numpy / assert_warn_len_equal

Function assert_warn_len_equal

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

Source from the content-addressed store, hash-verified

1708
1709
1710def assert_warn_len_equal(mod, n_in_context):
1711 try:
1712 mod_warns = mod.__warningregistry__
1713 except AttributeError:
1714 # the lack of a __warningregistry__
1715 # attribute means that no warning has
1716 # occurred; this can be triggered in
1717 # a parallel test scenario, while in
1718 # a serial test scenario an initial
1719 # warning (and therefore the attribute)
1720 # are always created first
1721 mod_warns = {}
1722
1723 num_warns = len(mod_warns)
1724
1725 if 'version' in mod_warns:
1726 # Python adds a 'version' entry to the registry,
1727 # do not count it.
1728 num_warns -= 1
1729
1730 assert_equal(num_warns, n_in_context)
1731
1732
1733def test_warn_len_equal_call_scenarios():

Calls 1

assert_equalFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…