Commit graph

138 commits

Author SHA1 Message Date
Miss Islington (bot)
b1c31a1547
[3.12] gh-65453: Docs - clarify AttributeError behaviour on PropertyMock (GH-121666) (GH-121969)
Fixed at EuroPython 24 sprints.
(cherry picked from commit 94e6644584)

Co-authored-by: Vlastimil Zíma <ziima@users.noreply.github.com>
2024-07-19 10:03:54 +02:00
Miss Islington (bot)
d8981abb1c
[3.12] gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (GH-119232) (#119283)
gh-118912: Remove description of issue fixed in 3.5 from autospeccing guide (GH-119232)

* Remove description of issue fixed in 3.5 from autospeccing guide

* Make autospeccing note text more succint and lint whitespace

* Add linting changes (missed in last commit)

---------

(cherry picked from commit 7e57640c7e)

Co-authored-by: Shauna <shaunagm@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-05-20 23:40:17 +00:00
Miss Islington (bot)
17389446c6
[3.12] Use correct markup in unittest.mock.reset_mock documentation (GH-119207) (GH-119249)
Use correct markup in unittest.mock.reset_mock documentation (GH-119207)
(cherry picked from commit 6b80a5b20f)

Co-authored-by: Tialo <65392801+Tialo@users.noreply.github.com>
2024-05-20 22:12:29 +02:00
Miss Islington (bot)
b83b3cb9da
[3.12] docs: module page titles should not start with a link to themselves (GH-117099) (#118791)
docs: module page titles should not start with a link to themselves (GH-117099)
(cherry picked from commit bcb435ee8f)

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-05-08 19:42:01 +00:00
Hugo van Kemenade
eb0bfb5910
[3.12] Docs: add link roles with Sphinx extlinks (GH-117850) (#117910)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-04-15 13:18:21 -06:00
infohash
ad0ff86034
[3.12] gh-75988: Fix issues with autospec ignoring wrapped object (GH-115223) (#117119)
gh-75988: Fix issues with autospec ignoring wrapped object (#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 735fc2cbbc)
2024-03-22 09:47:52 +00:00
Miss Islington (bot)
240e5f613b
[3.12] Docs: mark up NotImplemented using the :data: role throughout the docs (GH-116135) (#116147)
(cherry picked from commit dbe44f150c)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-02-29 20:53:51 +00:00
Miss Islington (bot)
c726d1cc67
[3.12] Document use of ANY in test assertions (GH-94060) (GH-115607)
(cherry picked from commit 04005f5021)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2024-02-17 13:24:20 +00:00
Miss Islington (bot)
b9e15bef82
[3.12] Link to the glossary for "magic methods" in `MagicMock` (GH-111292) (#114002)
Link to the glossary for "magic methods" in ``MagicMock`` (GH-111292)

The MagicMock documentation mentions magic methods several times without
actually pointing to the term in the glossary. This can be helpful for
people to fully understand what those magic methods are.
(cherry picked from commit e97da8677f)

Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
2024-01-12 23:00:50 +00:00
Miss Islington (bot)
00324a77da
[3.12] gh-101100: Fix various Sphinx warnings for dunder references in the library/ directory (GH-113163) (#113183)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-15 17:22:07 +00:00
Miss Islington (bot)
91a6e98e92
[3.12] GH-101100: Fix reference warnings for `__enter__ and __exit__` (GH-110112) (#111075)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-19 18:34:25 +03:00
Miss Islington (bot)
cdcab408a0
[3.12] GH-101100: Fix reference warnings for `__getitem__` (GH-110118) (#111073)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2023-10-19 18:33:03 +03:00
Miss Islington (bot)
cae968ba17
[3.12] gh-110631: Fix reST indentation in Doc/library (GH-110685) (#110736)
gh-110631: Fix reST indentation in `Doc/library` (GH-110685)

Fix wrong indentation in the Doc/library dir.
(cherry picked from commit bb7923f556)

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
2023-10-11 23:11:28 +02:00
Serhiy Storchaka
84e52171b5
[3.12] gh-106909: Use role :const: for referencing module constants (GH-106910) (GH-106956)
(cherry picked from commit 4b9948617f)
2023-07-21 14:49:39 +03:00
Wagner Alberto
cb944d0be8
Add import of unittest.mock.Mock in documentation (#102346) 2023-03-03 22:55:31 +05:30
Steve Kowalik
a1f08f5f19
Correct trivial grammar in reset_mock docs (#101861) 2023-02-13 11:11:43 +02:00
Stanley
286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
Oleg Iarygin
f62ff97f31
gh-93851: Fix all broken links in Doc/ (GH-93853) 2022-06-21 20:55:18 +02:00
Alex Waygood
6823ba4a9e
gh-92417: unittest.mock docs: remove references to Python <2.6 (GH-92539) 2022-05-10 08:47:36 +03:00
Gregory P. Smith
ac1fb07b6e
bpo-47235: Note where a typo is intentional in code. (GH-32348)
People keep popping up reporting these as typos in the docs despite
being described as typos in the surrounding text.  Hopefully a comment
on the line itself makes it more obvious?

Arguably some of the typo examples are not using the "right" typo as the
"assret" one in particular is now detected by default due to how common
it was in actual code.  But I don't want to to typo chasing by changing
these examples to be other not yet auto-detected typos as they still
illustrate the point well enough.
2022-04-06 08:06:58 -07:00
Victor Stinner
5ab745fc51
bpo-46852: Remove the float.__set_format__() method (GH-31585)
Remove the undocumented private float.__set_format__() method,
previously known as float.__set_format__() in Python 3.7. Its
docstring said: "You probably don't want to use this function. It
exists mainly to be used in Python's test suite."
2022-02-26 00:53:27 +01:00
Joe
10bf0a9ac3
doc: fix a typo in unittest.mock.rst (GH-30227) 2021-12-26 13:09:17 +02:00
Serhiy Storchaka
f9cd40f5e2
bpo-45010: Remove support of special method __div__ in unittest.mock (GH-27965) 2021-08-26 20:19:47 +02:00
Jack DeVries
938e84b4fa
bpo-44679: [doc] fix typo in unittest.mock.rst (GH-27618) 2021-08-05 13:48:18 -07:00
Jack DeVries
abb08e3af6
bpo-44534: fix wording and docstring sync in unittest.Mock GH27000 2021-07-05 07:52:32 +01:00
Mariusz Felisiak
b06ed1d883
Remove duplicate words in docs. (GH-26167) 2021-05-21 23:39:09 +05:30
Eddie Peters
2122e48630
bpo-43400: Remove "easy to use" from mock docs (GH-24752) 2021-03-04 15:39:29 -08:00
vabr-g
9fc571359a
bpo-41877: Improve docs for assert misspellings check in mock (GH-23729)
This is a follow-up to
4662fa9bfe.
That original commit expanded guards against misspelling assertions on
mocks. This follow-up updates the documentation and improves the error
message by pointing out the potential cause and solution.

Automerge-Triggered-By: GH:gpshead
2020-12-10 10:35:28 -08:00
Jordan Speicher
9b01c598ca
bpo-41325: Add version note for args and kwargs property in call object (GH-21525) 2020-07-18 18:35:44 +05:30
Brian Curtin
e00c1d0c45
Remove note saying patch is straightforward (#18431)
While `unittest.mock.patch` is a great thing, it is not straightforward.
If it were straightforward there wouldn't be such a huge amount of
documentation for it, and frankly, when myself and others who I've
read about often struggle to figure out what on earth `patch()` wants,
coming to the docs to read that it's straightforward is not helpful.
2020-02-10 10:47:17 -07:00
Paulo Henrique Silva
40c080934b bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521) 2020-01-25 10:53:54 +00:00
Elena Oat
cf288b53e4 Fix AsyncMock base class in the docs (GH-18008) 2020-01-15 09:50:57 +00:00
Jason Fried
046442d02b bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] (GH-17269) 2019-11-20 16:27:51 -08:00
John Belmonte
279d8df5e5 bpo-38753: AsyncMock added in version 3.8 (GH-17102) 2019-11-19 16:30:43 -08:00
Serhiy Storchaka
138ccbb022
bpo-38738: Fix formatting of True and False. (GH-17083)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
2019-11-12 16:57:03 +02:00
Lisa Roach
3667e1ee6c
bpo-38163: Child mocks detect their type as sync or async (GH-16471) 2019-09-29 21:56:47 -07:00
Lisa Roach
ef04851775
bpo-38136: Updates await_count and call_count to be different things (GH-16192) 2019-09-23 20:49:40 -07:00
Emmanuel Arias
31a82e25b6 bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456) 2019-09-12 13:29:54 +02:00
Lisa Roach
b9f65f01fd
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)
* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.

* Adds skip and fixes warning.

* Removes extra >>>.

* Adds ... in front of await mock().
2019-09-09 17:54:13 +01:00
Mario Corchero
f5e7f39d29 docs: Add references to AsyncMock in unittest.mock.patch (#13681)
Update the docs as patch can now return an AsyncMock if the patched
object is an async function.
2019-09-09 15:18:06 +01:00
Rémi Lapeyre
f5896a05ed bpo-35946: Improve assert_called_with documentation (GH-11796) 2019-08-29 02:15:53 -04:00
Ismail S
f9590edfea Fix docs for assert_called and assert_called_once (#15197) 2019-08-12 01:57:03 -05:00
Xtreak
0ae022c6a4 bpo-37075: Fix string concatenation in assert_has_awaits error message (GH-13616)
* Fix the implicit string concatenation in `assert_has_awaits` error message.
* Use "await" instead of "call" in `assert_awaited_with` error message.



https://bugs.python.org/issue37075
2019-05-29 00:02:25 -07:00
Mario Corchero
04530812e9 bpo-32299: Return patched dict when using patch.dict as a context manager (GH-11062) 2019-05-28 08:53:30 -04:00
Xtreak
ff6b2e66b1 bpo-37047: Refactor AsyncMock setup logic for autospeccing (GH-13574)
Handle late binding and attribute access in unittest.mock.AsyncMock
setup for autospeccing.
2019-05-27 14:56:23 +02:00
Xtreak
e7cb23bf20 Fix RuntimeWarning in unittest.mock asyncio example (GH-13449)
* This PR fixes the `RuntimeWarning` in `inspect.isawaitable(mock())` where `mock()` was not awaited.
* Fix typo in asynctest project.
2019-05-21 01:47:17 -07:00
Lisa Roach
77b3b7701a
bpo-26467: Adds AsyncMock for asyncio Mock library support (GH-9296) 2019-05-20 09:19:53 -07:00
Kumar Akshay
b0df45e55d bpo-21269: Provide args and kwargs attributes on mock call objects GH11807 2019-03-22 08:10:40 +00:00
Joan Massich
dc69f69f14 Fix typo in unittest.mock documentation: manger -> manager (GH-12352) 2019-03-17 16:34:22 -07:00
Pablo Galindo
d6acf17c05
Add example to the documentation for calling unittest.mock.patch with create=True (GH-11056) 2019-01-09 21:43:24 +00:00