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

Method test_kw_combinations

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

Source from the content-addressed store, hash-verified

131 self.assertEqual(p(3,4), ((1,2,3,4), {}))
132
133 def test_kw_combinations(self):
134 # exercise special code paths for no keyword args in
135 # either the partial object or the caller
136 p = self.partial(capture)
137 self.assertEqual(p.keywords, {})
138 self.assertEqual(p(), ((), {}))
139 self.assertEqual(p(a=1), ((), {'a':1}))
140 p = self.partial(capture, a=1)
141 self.assertEqual(p.keywords, {'a':1})
142 self.assertEqual(p(), ((), {'a':1}))
143 self.assertEqual(p(b=2), ((), {'a':1, 'b':2}))
144 # keyword args in the call override those in the partial object
145 self.assertEqual(p(a=3, b=2), ((), {'a':3, 'b':2}))
146
147 def test_positional(self):
148 # make sure positional arguments are captured correctly

Callers

nothing calls this directly

Calls 3

partialMethod · 0.80
pFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected