MCPcopy Create free account
hub / github.com/python/cpython / test_placeholders_kw_restriction

Method test_placeholders_kw_restriction

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

Source from the content-addressed store, hash-verified

269 self.assertEqual(p2(1), ((1, 0), {}))
270
271 def test_placeholders_kw_restriction(self):
272 PH = self.module.Placeholder
273 with self.assertRaisesRegex(TypeError, "Placeholder"):
274 self.partial(capture, a=PH)
275 # Passes, as checks via `is` and not `eq`
276 p = self.partial(capture, a=ALWAYS_EQ)
277 actual_args, actual_kwds = p()
278 self.assertEqual(actual_args, ())
279 self.assertEqual(len(actual_kwds), 1)
280 self.assertIs(actual_kwds['a'], ALWAYS_EQ)
281
282 def test_construct_placeholder_singleton(self):
283 PH = self.module.Placeholder

Callers

nothing calls this directly

Calls 5

assertRaisesRegexMethod · 0.80
partialMethod · 0.80
pFunction · 0.50
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected