Lines Matching refs:args
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):
420 def __new__(cls, /, *args, **kw):
427 bound_args = _MOCK_SIG.bind_partial(cls, *args, **kw).arguments
640 args = arg.split('.')
641 final = args.pop()
643 for entry in args:
780 value = lambda *args, **kw: original(self, *args, **kw)
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):
923 Raises an AssertionError if the args and keyword args passed in are
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)
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)
1350 def decoration_helper(self, patched, args, keywargs):
1360 args += tuple(extra_args)
1361 yield (args, keywargs)
1371 def patched(*args, **keywargs):
1373 args,
1388 async def patched(*args, **keywargs):
1390 args,
1542 # can't set keyword args when we aren't creating the mock
1825 def _inner(*args, **kw):
1828 return f(*args, **kw)
1837 async def _inner(*args, **kw):
1840 return await f(*args, **kw)
1905 def __exit__(self, *args):
1988 def method(self, /, *args, **kw):
1989 return func(self, *args, **kw)
2104 def __init__(self, /, *args, **kw):
2106 _safe_super(MagicMixin, self).__init__(*args, **kw)
2147 def __init__(self, /, *args, **kw):
2149 _safe_super(AsyncMagicMixin, self).__init__(*args, **kw)
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):
2449 args_string = ', '.join([repr(arg) for arg in args])
2467 `(args, kwargs)` or `(name, args, kwargs)`.
2469 If args or kwargs are empty then a call tuple will compare equal to
2485 args = ()
2489 name, args, kwargs = value
2495 args = second
2499 args, kwargs = first, second
2505 args = 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
2608 def args(self):
2624 args, kwargs = self
2626 name, args, kwargs = self
2633 return _format_call_signature(name, args, 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):
2940 no args. Setting it calls the mock with the value being set.