Skip to content

Commit 38094b5

Browse files
committed
Add test for ionelmc#10.
1 parent da4109f commit 38094b5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_lazy_object_proxy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,6 +1818,16 @@ def test_garbage_collection(lazy_object_proxy):
18181818
assert ref() is None
18191819

18201820

1821+
@pytest.mark.skipif(platform.python_implementation() != 'CPython',
1822+
reason="Interpreter doesn't have reference counting")
1823+
def test_garbage_collection_count(lazy_object_proxy):
1824+
obj = object()
1825+
count = sys.getrefcount(obj)
1826+
for _ in range(100):
1827+
str(lazy_object_proxy.Proxy(lambda: obj))
1828+
assert count == sys.getrefcount(obj)
1829+
1830+
18211831
@pytest.mark.parametrize("name", ["slots", "cext", "simple", "django", "objproxies"])
18221832
def test_perf(benchmark, name):
18231833
implementation = load_implementation(name)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy