MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_cached_int_object

Function test_cached_int_object

tests/python/test_bigints.py:17–25  ·  view source on GitHub ↗
(py_number)

Source from the content-addressed store, hash-verified

15 # CPython would reuse the objects for small ints in range [-5, 256]
16 # Making sure we don't do any changes on them
17 def test_cached_int_object(py_number):
18
19 # type is still int
20 assert type(py_number) is int
21 assert not isinstance(py_number, pm.bigint)
22 test_bigint(py_number)
23 assert type(py_number) is int
24 assert not isinstance(py_number, pm.bigint)
25 # the value doesn't change
26 # TODO (Tom Tang): Find a way to create a NEW int object with the same
27 # value, because int literals also reuse the cached int objects
28 for _ in range(2):

Callers 1

Calls 1

test_bigintFunction · 0.85

Tested by

no test coverage detected