mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)
This commit is contained in:
parent
4a686504eb
commit
2085bd0877
34 changed files with 126 additions and 261 deletions
|
@ -848,7 +848,7 @@ Here's an example implementation:
|
|||
|
||||
>>> from copy import deepcopy
|
||||
>>> class CopyingMock(MagicMock):
|
||||
... def __call__(self, *args, **kwargs):
|
||||
... def __call__(self, /, *args, **kwargs):
|
||||
... args = deepcopy(args)
|
||||
... kwargs = deepcopy(kwargs)
|
||||
... return super(CopyingMock, self).__call__(*args, **kwargs)
|
||||
|
@ -1042,7 +1042,7 @@ that it takes arbitrary keyword arguments (``**kwargs``) which are then passed
|
|||
onto the mock constructor:
|
||||
|
||||
>>> class Subclass(MagicMock):
|
||||
... def _get_child_mock(self, **kwargs):
|
||||
... def _get_child_mock(self, /, **kwargs):
|
||||
... return MagicMock(**kwargs)
|
||||
...
|
||||
>>> mymock = Subclass()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue