| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
(cherry picked from commit f05df0a4b679d0acfd0b1fe6187ba2d553b37afa)
Co-authored-by: Mario Corchero <mariocj89@gmail.com>
|
|
|
|
|
|
|
|
| |
_Call/_MagicProxy. (GH-10873)
Fix minor typo in test function name.
(cherry picked from commit e63e617ebbe481c498bdf037a62e09f4f9f3963f)
Co-authored-by: Andrew Dunai <andunai@gmail.com>
|
|
|
|
|
|
|
| |
Also refactor the call recording implementation and add some notes
about its limitations.
(cherry picked from commit 8ca0fa9d2f4de6e69f0902790432e0ab2f37ba68)
Co-authored-by: Chris Withers <chris@withers.org>
|
|
|
|
|
| |
(cherry picked from commit edeca92c84a3b08902ecdfe987cde00c7e617887)
Co-authored-by: Xtreak <tirkarthi@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
| |
lines. (GH-10284) (GH-10335)
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..
(cherry picked from commit 34fd4c20198dea6ab2fe8dc6d32d744d9bde868d)
|
|
|
|
|
| |
(cherry picked from commit 9d6d06e8065d45f375f4a80e2d7e13b032da1f5b)
Co-authored-by: Ned Deily <nad@python.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
(cherry picked from commit 856cbcc12f2e4cca93af5dc7ed6bcea4dd942f10)
|
|
|
| |
(cherry picked from commit 9d56b34af2efc4e266bf3ae62da5cd2e422a42be)
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter
anymore.
Patch written 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.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| | |
Patch from https://github.com/testing-cabal/mock/issues/215
|
| |
| |
| |
| | |
Patch from https://github.com/testing-cabal/mock/issues/215
|
|\ \
| |/
| |
| | |
could in Python 3.3.
|
| |
| |
| |
| | |
could in Python 3.3.
|
|\ \
| |/
| |
| | |
Patch from Nicola Palumbo and Laurent De Buyst.
|
| |
| |
| |
| | |
Patch from Nicola Palumbo and Laurent De Buyst.
|
| |
| |
| |
| | |
Behavior equivalent to m.configure_mock(). Patch by Kasia Jachim.
|
| |
| |
| |
| | |
This was a regression vs Python 3.4. Patch from Ignacio Rossi
|
| |
| |
| |
| | |
Behavior equivalent to m.configure_mock(). Patch by Kasia Jachim.
|
|\ \
| |/
| |
| | |
Patch by Håkan Lövdahl.
|
| |
| |
| |
| | |
Patch by Håkan Lövdahl.
|
| |
| |
| |
| | |
Patch by Håkan Lövdahl.
|
| |
| |
| |
| | |
implementation in issue #21408 they are redundant.
|
| | |
|
| |
| |
| |
| | |
Fixed an output of sets in examples.
|
| | |
|