summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-11-13 18:30:00 (GMT)
committerGitHub <noreply@github.com>2022-11-13 18:30:00 (GMT)
commitd329f859b9cea9e6fa76fdf03927f659cf17786b (patch)
treeb42577a7387bbab0f5a10520e8397a685af16074 /Lib/test/test_gc.py
parent439b9cfaf43080e91c4ad69f312f21fa098befc7 (diff)
downloadcpython-d329f859b9cea9e6fa76fdf03927f659cf17786b.zip
cpython-d329f859b9cea9e6fa76fdf03927f659cf17786b.tar.gz
cpython-d329f859b9cea9e6fa76fdf03927f659cf17786b.tar.bz2
gh-99430: Remove duplicated tests for old-styled classes (#99432)
python 1 & 2 were a loong time ago.
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r--Lib/test/test_gc.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 087f727..db7cb9ac 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -542,48 +542,6 @@ class GCTests(unittest.TestCase):
self.assertEqual(gc.collect(), 2)
self.assertEqual(len(gc.garbage), garbagelen)
- def test_boom_new(self):
- # boom__new and boom2_new are exactly like boom and boom2, except use
- # new-style classes.
-
- class Boom_New(object):
- def __getattr__(self, someattribute):
- del self.attr
- raise AttributeError
-
- a = Boom_New()
- b = Boom_New()
- a.attr = b
- b.attr = a
-
- gc.collect()
- garbagelen = len(gc.garbage)
- del a, b
- self.assertEqual(gc.collect(), 2)
- self.assertEqual(len(gc.garbage), garbagelen)
-
- def test_boom2_new(self):
- class Boom2_New(object):
- def __init__(self):
- self.x = 0
-
- def __getattr__(self, someattribute):
- self.x += 1
- if self.x > 1:
- del self.attr
- raise AttributeError
-
- a = Boom2_New()
- b = Boom2_New()
- a.attr = b
- b.attr = a
-
- gc.collect()
- garbagelen = len(gc.garbage)
- del a, b
- self.assertEqual(gc.collect(), 2)
- self.assertEqual(len(gc.garbage), garbagelen)
-
def test_get_referents(self):
alist = [1, 3, 5]
got = gc.get_referents(alist)