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

Method test_int

numpy/core/tests/test_multiarray.py:267–284  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

265class TestHash:
266 # see #3793
267 def test_int(self):
268 for st, ut, s in [(np.int8, np.uint8, 8),
269 (np.int16, np.uint16, 16),
270 (np.int32, np.uint32, 32),
271 (np.int64, np.uint64, 64)]:
272 for i in range(1, s):
273 assert_equal(hash(st(-2**i)), hash(-2**i),
274 err_msg="%r: -2**%d" % (st, i))
275 assert_equal(hash(st(2**(i - 1))), hash(2**(i - 1)),
276 err_msg="%r: 2**%d" % (st, i - 1))
277 assert_equal(hash(st(2**i - 1)), hash(2**i - 1),
278 err_msg="%r: 2**%d - 1" % (st, i))
279
280 i = max(i - 1, 1)
281 assert_equal(hash(ut(2**(i - 1))), hash(2**(i - 1)),
282 err_msg="%r: 2**%d" % (ut, i - 1))
283 assert_equal(hash(ut(2**i - 1)), hash(2**i - 1),
284 err_msg="%r: 2**%d - 1" % (ut, i))
285
286
287class TestAttributes:

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
maxFunction · 0.50

Tested by

no test coverage detected