MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_arg_errors

Method test_arg_errors

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

Source from the content-addressed store, hash-verified

2145 self.assertEqual(res, [199])
2146
2147 def test_arg_errors(self):
2148 def fin(*args, **kwargs):
2149 res.append((args, kwargs))
2150
2151 a = self.A()
2152
2153 res = []
2154 f = weakref.finalize(a, fin, 1, 2, func=3, obj=4)
2155 self.assertEqual(f.peek(), (a, fin, (1, 2), {'func': 3, 'obj': 4}))
2156 f()
2157 self.assertEqual(res, [((1, 2), {'func': 3, 'obj': 4})])
2158
2159 with self.assertRaises(TypeError):
2160 weakref.finalize(a, func=fin, arg=1)
2161 with self.assertRaises(TypeError):
2162 weakref.finalize(obj=a, func=fin, arg=1)
2163 self.assertRaises(TypeError, weakref.finalize, a)
2164 self.assertRaises(TypeError, weakref.finalize)
2165
2166 def test_order(self):
2167 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