Skip to content

[3.12] gh-75988: Fix issues with autospec ignoring wrapped object (GH-115223)#117119

Merged
cjw296 merged 1 commit intopython:3.12from
infohash:backport-735fc2c-3.12
Mar 22, 2024
Merged

[3.12] gh-75988: Fix issues with autospec ignoring wrapped object (GH-115223)#117119
cjw296 merged 1 commit intopython:3.12from
infohash:backport-735fc2c-3.12

Conversation

@infohash
Copy link
Contributor

@infohash infohash commented Mar 21, 2024

  • Added a condition to take wraps into consideration when autospeccing objects

  • Added test cases to test wraps of a class, a class instance and a function type

  • Added order of precedence of side_effect, return_value and wraps in docs

(cherry picked from commit 735fc2c)


📚 Documentation preview 📚: https://cpython-previews--117119.org.readthedocs.build/

…hon#115223)

* set default return value of functional types as _mock_return_value

* added test of wrapping child attributes

* added backward compatibility with explicit return

* added docs on the order of precedence

* added test to check default return_value

(cherry picked from commit 735fc2c)
@cjw296 cjw296 merged commit ad0ff86 into python:3.12 Mar 22, 2024
@infohash infohash deleted the backport-735fc2c-3.12 branch March 22, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants