MCPcopy Index your code
hub / github.com/python/cpython / test_arg_errors

Method test_arg_errors

Lib/test/test_weakref.py:2164–2181  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2162 self.assertEqual(res, [199])
2163
2164 def test_arg_errors(self):
2165 def fin(*args, **kwargs):
2166 res.append((args, kwargs))
2167
2168 a = self.A()
2169
2170 res = []
2171 f = weakref.finalize(a, fin, 1, 2, func=3, obj=4)
2172 self.assertEqual(f.peek(), (a, fin, (1, 2), {'func': 3, 'obj': 4}))
2173 f()
2174 self.assertEqual(res, [((1, 2), {'func': 3, 'obj': 4})])
2175
2176 with self.assertRaises(TypeError):
2177 weakref.finalize(a, func=fin, arg=1)
2178 with self.assertRaises(TypeError):
2179 weakref.finalize(obj=a, func=fin, arg=1)
2180 self.assertRaises(TypeError, weakref.finalize, a)
2181 self.assertRaises(TypeError, weakref.finalize)
2182
2183 def test_order(self):
2184 a = self.A()

Callers

nothing calls this directly

Calls 6

AMethod · 0.80
fFunction · 0.70
finalizeMethod · 0.45
assertEqualMethod · 0.45
peekMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected