@@ -1420,7 +1420,7 @@ patch
14201420
14211421 The key is to do the patching in the right namespace. See the section `where to patch `_.
14221422
1423- .. function :: patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
1423+ .. function :: patch(target, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *, unsafe=False, * *kwargs)
14241424
14251425 :func: `patch ` acts as a function decorator, class decorator or a context
14261426 manager. Inside the body of the function or with statement, the *target *
@@ -1485,6 +1485,10 @@ patch
14851485 By default this is ``'test' ``, which matches the way :mod: `unittest ` finds tests.
14861486 You can specify an alternative prefix by setting ``patch.TEST_PREFIX ``.
14871487
1488+ Patch will raise a `RuntimeError ` if passed some common misspellings of
1489+ the arguments autospec and spec_set. Pass the argument `unsafe ` with the
1490+ value True to disable that check.
1491+
14881492 Patch can be used as a context manager, with the with statement. Here the
14891493 patching applies to the indented block after the with statement. If you
14901494 use "as" then the patched object will be bound to the name after the
@@ -1622,7 +1626,7 @@ work as expected::
16221626patch.object
16231627~~~~~~~~~~~~
16241628
1625- .. function :: patch.object(target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs)
1629+ .. function :: patch.object(target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, *, unsafe=False, * *kwargs)
16261630
16271631 patch the named member (*attribute *) on an object (*target *) with a mock
16281632 object.
@@ -2404,7 +2408,7 @@ arguments are a dictionary:
24042408create_autospec
24052409~~~~~~~~~~~~~~~
24062410
2407- .. function :: create_autospec(spec, spec_set=False, instance=False, **kwargs)
2411+ .. function :: create_autospec(spec, spec_set=False, instance=False, *, unsafe=False, * *kwargs)
24082412
24092413 Create a mock object using another object as a spec. Attributes on the
24102414 mock will use the corresponding attribute on the *spec * object as their
@@ -2421,6 +2425,10 @@ create_autospec
24212425 spec for an instance object by passing ``instance=True ``. The returned mock
24222426 will only be callable if instances of the mock are callable.
24232427
2428+ `create_autospec ` will raise a `RuntimeError ` if passed some common
2429+ misspellings of the arguments autospec and spec_set. Pass the argument
2430+ `unsafe ` with the value True to disable that check.
2431+
24242432 :func: `create_autospec ` also takes arbitrary keyword arguments that are passed to
24252433 the constructor of the created mock.
24262434
0 commit comments