summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 6f15c03..ce5bbfc 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -1866,20 +1866,10 @@ class FinalizeTestCase(unittest.TestCase):
f()
self.assertEqual(res, [((1, 2), {'func': 3, 'obj': 4})])
- res = []
- with self.assertWarns(DeprecationWarning):
- f = weakref.finalize(a, func=fin, arg=1)
- self.assertEqual(f.peek(), (a, fin, (), {'arg': 1}))
- f()
- self.assertEqual(res, [((), {'arg': 1})])
-
- res = []
- with self.assertWarns(DeprecationWarning):
- f = weakref.finalize(obj=a, func=fin, arg=1)
- self.assertEqual(f.peek(), (a, fin, (), {'arg': 1}))
- f()
- self.assertEqual(res, [((), {'arg': 1})])
-
+ with self.assertRaises(TypeError):
+ weakref.finalize(a, func=fin, arg=1)
+ with self.assertRaises(TypeError):
+ weakref.finalize(obj=a, func=fin, arg=1)
self.assertRaises(TypeError, weakref.finalize, a)
self.assertRaises(TypeError, weakref.finalize)