Skip to content

Commit

Permalink
Provide whitelist parity for MagicMock and Mock (#342)
Browse files Browse the repository at this point in the history
* Provide whitelist parity for `MagicMock` and `Mock`

There are whitelist entries for the `return_value` and `side_effect`
attributes of the `unittest.mock.Mock` class. This change seeks to
provide parity for the `unittest.mock.MagicMock` class, which is just a
subclass of `Mock` but with default implementations of most of the magic
methods.

Standard library reference:
https://docs.python.org/3/library/unittest.mock.html#magic-mock
  • Loading branch information
maxrake committed Dec 6, 2023
1 parent f13cc87 commit 3d0ad1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# next (unreleased)
* Bump flake8, flake8-comprehensions and flake8-bugbear. (Sebastian Csar,
#341).
* Bump flake8, flake8-comprehensions and flake8-bugbear (Sebastian Csar, #341).
* Switch to tomllib/tomli to support heterogeneous arrays (Sebastian Csar, #340).
* Provide whitelist parity for `MagicMock` and `Mock` (maxrake).

# 2.10 (2023-10-06)

Expand Down
3 changes: 3 additions & 0 deletions vulture/whitelists/unittest_whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@

mock.Mock.return_value
mock.Mock.side_effect

mock.MagicMock.return_value
mock.MagicMock.side_effect

0 comments on commit 3d0ad1a

Please sign in to comment.