Lines Matching defs:kwargs

130     def checksig(self, /, *args, **kwargs):
131 sig.bind(*args, **kwargs)
182 # creates a function with signature (*args, **kwargs) that delegates to a
191 def checksig(*args, **kwargs):
192 sig.bind(*args, **kwargs)
199 src = """def %s(*args, **kwargs):
200 _checksig_(*args, **kwargs)
201 return mock(*args, **kwargs)""" % name
211 def assert_called_with(*args, **kwargs):
212 return mock.assert_called_with(*args, **kwargs)
213 def assert_called(*args, **kwargs):
214 return mock.assert_called(*args, **kwargs)
215 def assert_not_called(*args, **kwargs):
216 return mock.assert_not_called(*args, **kwargs)
217 def assert_called_once(*args, **kwargs):
218 return mock.assert_called_once(*args, **kwargs)
219 def assert_called_once_with(*args, **kwargs):
220 return mock.assert_called_once_with(*args, **kwargs)
221 def assert_has_calls(*args, **kwargs):
222 return mock.assert_has_calls(*args, **kwargs)
223 def assert_any_call(*args, **kwargs):
224 return mock.assert_any_call(*args, **kwargs)
266 def wrapper(attr, /, *args, **kwargs):
267 return getattr(mock.mock, attr)(*args, **kwargs)
404 def __init__(self, /, *args, **kwargs):
439 _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs
472 if kwargs:
473 self.configure_mock(**kwargs)
626 def configure_mock(self, /, **kwargs):
635 for arg, val in sorted(kwargs.items(),
819 def _format_mock_call_signature(self, args, kwargs):
821 return _format_call_signature(name, args, kwargs)
824 def _format_mock_failure_message(self, args, kwargs, action='call'):
826 expected_string = self._format_mock_call_signature(args, kwargs)
867 Given a call (or simply an (args, kwargs) tuple), return a
881 args, kwargs = _call
883 name, args, kwargs = _call
885 bound_call = sig.bind(*args, **kwargs)
886 return call(name, bound_call.args, bound_call.kwargs)
920 def assert_called_with(self, /, *args, **kwargs):
926 expected = self._format_mock_call_signature(args, kwargs)
933 msg = self._format_mock_failure_message(args, kwargs)
935 expected = self._call_matcher(_Call((args, kwargs), two=True))
942 def assert_called_once_with(self, /, *args, **kwargs):
951 return self.assert_called_with(*args, **kwargs)
999 def assert_any_call(self, /, *args, **kwargs):
1005 expected = self._call_matcher(_Call((args, kwargs), two=True))
1009 expected_string = self._format_mock_call_signature(args, kwargs)
1104 _spec_state=None, _new_name='', _new_parent=None, **kwargs):
1108 _spec_state, _new_name, _new_parent, **kwargs
1114 def _mock_check_sig(self, /, *args, **kwargs):
1119 def __call__(self, /, *args, **kwargs):
1122 self._mock_check_sig(*args, **kwargs)
1123 self._increment_mock_call(*args, **kwargs)
1124 return self._mock_call(*args, **kwargs)
1127 def _mock_call(self, /, *args, **kwargs):
1128 return self._execute_mock_call(*args, **kwargs)
1130 def _increment_mock_call(self, /, *args, **kwargs):
1137 _call = _Call((args, kwargs), two=True)
1148 self.mock_calls.append(_Call(('', args, kwargs)))
1156 _new_parent.method_calls.append(_Call((method_call_name, args, kwargs)))
1162 this_mock_call = _Call((mock_call_name, args, kwargs))
1176 def _execute_mock_call(self, /, *args, **kwargs):
1189 result = effect(*args, **kwargs)
1198 return self._mock_wraps(*args, **kwargs)
1261 # _check_spec_arg_typos takes kwargs from commands like patch and checks that
1279 spec_set, autospec, new_callable, kwargs, *, unsafe=False
1291 _check_spec_arg_typos(kwargs)
1310 self.kwargs = kwargs
1318 self.autospec, self.new_callable, self.kwargs
1425 autospec, kwargs = self.autospec, self.kwargs
1496 _kwargs.update(kwargs)
1540 _name=self.attribute, **kwargs)
1541 elif kwargs:
1543 # XXXX If new is a Mock we could call new.configure_mock(**kwargs)
1544 raise TypeError("Can't pass kwargs to a mock we aren't creating")
1620 new_callable=None, *, unsafe=False, **kwargs
1642 spec_set, autospec, new_callable, kwargs, unsafe=unsafe
1647 autospec=None, new_callable=None, **kwargs):
1673 if not kwargs:
1678 items = list(kwargs.items())
1697 spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs
1773 spec_set, autospec, new_callable, kwargs, unsafe=unsafe
1806 def __init__(self, in_dict, values=(), clear=False, **kwargs):
1810 self.values.update(kwargs)
2105 self._mock_set_magics() # make magic work for kwargs in init
2148 self._mock_set_magics() # make magic work for kwargs in init
2197 def __init__(self, /, *args, **kwargs):
2198 super().__init__(*args, **kwargs)
2216 code_mock.co_varnames = ('args', 'kwargs')
2225 async def _execute_mock_call(self, /, *args, **kwargs):
2229 _call = _Call((args, kwargs), two=True)
2248 result = await effect(*args, **kwargs)
2250 result = effect(*args, **kwargs)
2260 return await self._mock_wraps(*args, **kwargs)
2261 return self._mock_wraps(*args, **kwargs)
2282 def assert_awaited_with(self, /, *args, **kwargs):
2287 expected = self._format_mock_call_signature(args, kwargs)
2291 msg = self._format_mock_failure_message(args, kwargs, action='await')
2294 expected = self._call_matcher(_Call((args, kwargs), two=True))
2300 def assert_awaited_once_with(self, /, *args, **kwargs):
2309 return self.assert_awaited_with(*args, **kwargs)
2311 def assert_any_await(self, /, *args, **kwargs):
2315 expected = self._call_matcher(_Call((args, kwargs), two=True))
2319 expected_string = self._format_mock_call_signature(args, kwargs)
2377 def reset_mock(self, /, *args, **kwargs):
2381 super().reset_mock(*args, **kwargs)
2446 def _format_call_signature(name, args, kwargs):
2451 '%s=%r' % (key, value) for key, value in kwargs.items()
2467 `(args, kwargs)` or `(name, args, kwargs)`.
2469 If args or kwargs are empty then a call tuple will compare equal to
2486 kwargs = {}
2489 name, args, kwargs = value
2497 kwargs = second
2499 args, kwargs = first, second
2507 kwargs = value
2510 return tuple.__new__(cls, (args, kwargs))
2512 return tuple.__new__(cls, (name, args, kwargs))
2555 # could be (name, args) or (name, kwargs) or (args, kwargs)
2578 def __call__(self, /, *args, **kwargs):
2580 return _Call(('', args, kwargs), name='()')
2583 return _Call((self._mock_name, args, kwargs), name=name, parent=self)
2601 args, kwargs = self
2603 name, args, kwargs = self
2605 return args, kwargs
2612 def kwargs(self):
2624 args, kwargs = self
2626 name, args, kwargs = self
2633 return _format_call_signature(name, args, kwargs)
2653 _name=None, *, unsafe=False, **kwargs):
2694 _check_spec_arg_typos(kwargs)
2696 _kwargs.update(kwargs)
2735 if is_type and not instance and 'return_value' not in kwargs:
2758 kwargs = {'spec': original}
2760 kwargs = {'spec_set': original}
2771 kwargs['_eat_self'] = skipfirst
2778 **kwargs)
2866 def _readlines_side_effect(*args, **kwargs):
2869 return _state[0].readlines(*args, **kwargs)
2871 def _read_side_effect(*args, **kwargs):
2874 return _state[0].read(*args, **kwargs)
2876 def _readline_side_effect(*args, **kwargs):
2879 yield _state[0].readline(*args, **kwargs)
2920 def reset_data(*args, **kwargs):
2942 def _get_child_mock(self, /, **kwargs):
2943 return MagicMock(**kwargs)