| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
call GH#12000
* Resolve string target to patch.dict during function call
* Add NEWS entry
* Remove unneeded call
* Restore original value for support.target and refactor assertions
* Add extra assertion to verify unpatched dict
|
|
|
|
| |
message. (GH-11804)
|
|
|
|
|
|
|
|
| |
* Allow repeated deletion of unittest.mock.Mock attributes
* fixup! Allow repeated deletion of unittest.mock.Mock attributes
* fixup! fixup! Allow repeated deletion of unittest.mock.Mock attributes
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
signature (GH11048)
* Fix partial and partial method signatures in mock
* Add more calls
* Add NEWS entry
* Use assertEquals and fix markup in NEWS
* Refactor branching and add markup reference for functools
* Revert partial object related changes and fix pr comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests: Further validate `wraps` functionality in `unittest.mock.Mock`
Add more tests to validate how `wraps` interacts with other features of
mocks.
* Don't call the wrapped object if `side_effect` is set
When a object is wrapped using `Mock(wraps=...)`, if an user sets a
`side_effect` in one of their methods, return the value of `side_effect`
and don't call the original object.
* Refactor what to be called on `mock_call`
When a `Mock` is called, it should return looking up in the following
order: `side_effect`, `return_value`, `wraps`. If any of the first two
return `mock.DEFAULT`, lookup in the next option.
It makes no sense to check for `wraps` returning default, as it is
supposed to be the original implementation and there is nothing to
fallback to.
|
|
|
|
|
| |
_Call/_MagicProxy. (#10873)
Fix minor typo in test function name.
|
|
|
|
| |
Also refactor the call recording imolementation and add some notes
about its limitations.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(GH-10284)
Two kind of mistakes:
1. Missed space. After concatenating there is no space between words.
2. Missed comma. Causes unintentional concatenating in a list of strings.
|
|
|
|
|
|
|
| |
failures (GH-10090)
unittest.mock now includes mock calls in exception messages if
assert_not_called, assert_called_once, or assert_called_once_with
fails.
|
|
|
|
| |
The MagicMock class supports many magic methods, but not __fspath__. To ease
testing with modules such as os.path, this function is now supported by default.
|
|
|
|
|
| |
The docs in `library/unittest.mock` have been updated to remove
confusing terms about submock and be explicit about the behavior
expected.
|
| |
|
|
|
|
|
| |
This makes the assertion error message more useful, aiding debugging.
Thanks @davidair!
|
| |
|
|
|
| |
unittest.mock.MagicMock now supports the __round__() magic method.
|
|
|
|
|
|
|
| |
The new method allows the developer to control when to stop the
feature of mocks that automagically creates new mocks when accessing
an attribute that was not declared before
Signed-off-by: Mario Corchero <mariocj89@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
functions (GH-3)
Cython will, in the right circumstances, offer a MethodType instance
where im_func is a builtin function. Any instance of MethodType is
automatically assumed to be a Python-defined function (more
specifically, a function that has an inspectable signature), but
_set_signature was still conservative in its assumptions. As a result
_set_signature would return early with None instead of a mock since
the im_func had no inspectable signature. This causes problems
deeper inside mock, as _set_signature is assumed to _always_
return a mock, and nothing checked its return value.
In similar corner cases, autospec will simply not check the spec of the
function, so _set_signature is amended to now return early with the
original, not-wrapped mock object.
Patch by Aaron Gallagher.
|
| |
|
|\ |
|
| |\ |
|
| | | |
|
| | |
| | |
| | |
| | | |
identity when they are copied or pickled.
|
|\ \ \
| |/ / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter
anymore.
Patch written by Jiajun Huang.
|
|/ /
| |
| |
| | |
Patch by Jiajun Huang.
|
| |
| |
| |
| | |
assert_called, assert_not_called, and assert_called_once.
|
|\ \
| |/
| |
| | |
_is_data_descriptor().
|
| |
| |
| |
| | |
_is_data_descriptor().
|
|\ \
| |/
| |
| |
| | |
subclasses of property() and other data descriptors. Removes the never
publicly used, never documented unittest.mock.DescriptorTypes tuple.
|
| |
| |
| |
| | |
for subclasses of property() and other data descriptors.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| | |
We now have two keyword only parameters in the reset_mock function to
selectively reset the return_value or the side_effects, or both.
|
|\ \
| |/
| |
| | |
Patch from Yolanda Robla.
|
| |
| |
| |
| | |
Patch from Yolanda Robla.
|
|\ \
| |/
| |
| |
| |
| |
| | |
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.
Patch by Andrew Plummer.
|
| |
| |
| |
| |
| |
| |
| | |
_Call is a subclass of tuple (changeset 3603bae63c13 only works
for classes) so we need to implement __ne__ ourselves.
Patch by Andrew Plummer.
|
| |
| |
| |
| |
| | |
Issue #26323: Add assert_called() and assert_called_once() methods to
unittest.mock.Mock.
|
|/
|
|
| |
Patch contributed by Robert Zimmerman.
|
|
|
|
|
|
| |
original values after patching.
Patch contributed by Sean McCully.
|
|\
| |
| |
| |
| |
| | |
boolean result instead of raising an exception.
Patch by A Kaptur.
|
| |
| |
| |
| |
| |
| | |
boolean result instead of raising an exception.
Patch by A Kaptur.
|
|\ \
| |/
| |
| |
| |
| | |
read_data is bytes.
Initial patch by Aaron Hill.
|
| |
| |
| |
| |
| |
| | |
read_data is bytes.
Initial patch by Aaron Hill.
|
|\ \
| |/ |
|
| | |
|