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

Method test_recursive_repr

Lib/test/test_functools.py:313–335  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311 for kwargs_repr in kwargs_reprs])
312
313 def test_recursive_repr(self):
314 name = f"{self.partial.__module__}.{self.partial.__qualname__}"
315
316 f = self.partial(capture)
317 f.__setstate__((f, (), {}, {}))
318 try:
319 self.assertEqual(repr(f), '%s(...)' % (name,))
320 finally:
321 f.__setstate__((capture, (), {}, {}))
322
323 f = self.partial(capture)
324 f.__setstate__((capture, (f,), {}, {}))
325 try:
326 self.assertEqual(repr(f), '%s(%r, ...)' % (name, capture,))
327 finally:
328 f.__setstate__((capture, (), {}, {}))
329
330 f = self.partial(capture)
331 f.__setstate__((capture, (), {'a': f}, {}))
332 try:
333 self.assertEqual(repr(f), '%s(%r, a=...)' % (name, capture,))
334 finally:
335 f.__setstate__((capture, (), {}, {}))
336
337 def test_pickle(self):
338 with replaced_module('functools', self.module):

Callers

nothing calls this directly

Calls 3

partialMethod · 0.80
__setstate__Method · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected