Miss Islington (bot)
7734738d71
bpo-41325: Add version note for args and kwargs property in call object (GH-21525)
...
(cherry picked from commit 9b01c598ca
)
Co-authored-by: Jordan Speicher <uSpike@users.noreply.github.com>
2020-07-18 06:13:21 -07:00
Miss Islington (bot)
8c0f0016e2
bpo-38753: AsyncMock added in version 3.8 (GH-17102)
...
(cherry picked from commit 279d8df5e5
)
Co-authored-by: John Belmonte <john@neggie.net>
2019-12-24 20:42:24 -08:00
Lisa Roach
b2744c1be7
[3.8] bpo-38857: AsyncMock fix for awaitable values and StopIteration fix [3.8] (GH-17269) ( #17304 )
...
(cherry picked from commit 046442d02b
)
Co-authored-by: Jason Fried <fried@fb.com>
2019-11-21 20:14:32 +02:00
Serhiy Storchaka
d360346640
[3.8] bpo-38738: Fix formatting of True and False. (GH-17083) (GH-17125)
...
* "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>".
(cherry picked from commit 138ccbb022
)
2019-11-12 18:54:10 +02:00
Lisa Roach
21f24ead90
[3.8] bpo-38163: Child mocks detect their type as sync or async (GH-16471) (GH-16484)
2019-09-29 22:22:44 -07:00
Lisa Roach
52bdd414ed
[3.8] bpo-38136: Updates await_count and call_count to be different things (GH-16192) (GH-16431)
2019-09-27 15:44:34 -07:00
Miss Islington (bot)
648494b44a
bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456)
...
(cherry picked from commit 31a82e25b6
)
Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-09-12 04:37:05 -07:00
Miss Islington (bot)
eaa1b09412
docs: Add references to AsyncMock in unittest.mock.patch (GH-13681)
...
Update the docs as patch can now return an AsyncMock if the patched
object is an async function.
(cherry picked from commit f5e7f39d29
)
Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
2019-09-10 06:15:19 -07:00
Miss Islington (bot)
d4391aa5eb
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (GH-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().
(cherry picked from commit b9f65f01fd
)
Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
2019-09-10 00:31:34 -07:00
Miss Islington (bot)
612d3935ec
bpo-35946: Improve assert_called_with documentation (GH-11796)
...
(cherry picked from commit f5896a05ed
)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-08-28 23:39:47 -07:00
Miss Islington (bot)
2f087e279b
Fix docs for assert_called and assert_called_once (GH-15219)
...
(cherry picked from commit f9590edfea
)
Co-authored-by: Ismail S <ismail-s@users.noreply.github.com>
2019-08-12 09:19:47 +01: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
Chris Withers
8ca0fa9d2f
bpo-35226: Fix equality for nested unittest.mock.call objects. ( #10555 )
...
Also refactor the call recording imolementation and add some notes
about its limitations.
2018-12-03 21:31:37 +00:00
Max Bélanger
6c83d9f4a7
bpo-35022: unittest.mock.MagicMock now also supports __fspath__ (GH-9960)
...
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.
2018-10-25 23:48:58 +02:00
Mario Corchero
96200eb2ff
unittest.mock doc: Fix references to recursive seal of Mocks (GH-9028)
...
The docs in `library/unittest.mock` have been updated to remove
confusing terms about submock and be explicit about the behavior
expected.
2018-10-19 23:57:37 +02:00
Stéphane Wirtel
859c068e52
bpo-34962: make doctest in Doc/ now passes, and is enforced in CI (GH-9806)
2018-10-12 09:51:05 +02:00
Andrés Delfino
271818fe27
Fix "Python" casing in a few places (GH-9001)
2018-09-14 10:13:09 -07:00
Tony Flury
2087023fde
bpo-32933: Implement __iter__ method on mock_open() (GH-5974)
2018-09-13 01:21:16 +03:00
Andrés Delfino
f85af035c5
Fix margin in sentinel and mock_open (GH-8188)
2018-07-08 17:28:51 -07:00
John Reese
6c4fab0f4b
bpo-33516: Add support for __round__ in MagicMock (GH-6880)
...
unittest.mock.MagicMock now supports the __round__() magic method.
2018-05-22 22:01:10 +02:00
Stéphane Wirtel
19177fbd5d
bpo-33503: Fix the broken pypi link in the source and the documentation (GH-6814)
2018-05-15 14:58:35 -04:00
Paul Ganssle
85ac726a40
Cleanup grammar in unittest.mock.seal documentation ( #5107 )
2018-01-06 15:25:34 +02:00
luzpaz
a5293b4ff2
Fix miscellaneous typos ( #4275 )
2017-11-05 15:37:50 +02:00
Mario Corchero
552be9d7e6
bpo-30541: Add new method to seal mocks (GH61923)
...
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>
2017-10-17 04:35:11 -07:00
Ben Lloyd
15033d145b
Corrected grammar mistake in documentation ( #1713 )
...
There was an unneeded space before a closing parenthesis in the `unittest.mock` documentation.
2017-05-22 14:06:56 +03:00
Arne de Laat
324c5d8ca6
bpo-28911: Clarify the behaviour of assert_called_once_with. ( #251 )
2017-02-23 15:57:25 +01:00
Serhiy Storchaka
d9c956fb23
Issue #20804 : The unittest.mock.sentinel attributes now preserve their
...
identity when they are copied or pickled.
2017-01-11 20:13:03 +02:00
Serhiy Storchaka
989db5c880
Issue #19795 : Mark up None as literal text.
2016-10-19 16:37:13 +03:00
Serhiy Storchaka
ecf41da83e
Issue #19795 : Mark up None as literal text.
2016-10-19 16:29:26 +03:00
Berker Peksag
c29dd2257e
Issue #27531 : Merge from 3.5
2016-07-17 15:27:10 +03:00
Berker Peksag
ebf9fd31a8
Issue #27531 : Update signature of Mock.assert_not_called method
...
Since 01ae1ac2daf4, it doesn't accept any arguments.
Patch by Michael Killough.
2016-07-17 15:26:46 +03:00
Terry Jan Reedy
4da945f361
Merge Issue #22558 .
2016-06-11 15:06:08 -04:00
Terry Jan Reedy
fa089b9b0b
Issue #22558 : Add remaining doc links to source code for Python-coded modules.
...
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Kushal Das
9cd39a170b
Issue #21271 : Adds new keyword only parameters in reset_mock call
...
We now have two keyword only parameters in the reset_mock function to
selectively reset the return_value or the side_effects, or both.
2016-06-02 10:20:16 -07:00
Berker Peksag
8e72f503b1
Fix typos in mock and exceptions docs
...
The default value of __len__ is 0, not 1:
>>> from unittest.mock import MagicMock
>>> mock = MagicMock()
>>> len(mock)
0
Reported by Alex on docs@p.o.
Remove the remaining VMSError reference. VMS support is gone.
2016-04-11 12:23:25 +03:00
Berker Peksag
8fafc74d45
Fix typos in mock and exceptions docs
...
The default value of __len__ is 0, not 1:
>>> from unittest.mock import MagicMock
>>> mock = MagicMock()
>>> len(mock)
0
Reported by Alex on docs@p.o.
Remove the remaining VMSError reference. VMS support is gone.
2016-04-11 12:23:04 +03:00
Victor Stinner
2c2a4e63d7
Add Mock.assert_called()
...
Issue #26323 : Add assert_called() and assert_called_once() methods to
unittest.mock.Mock.
2016-03-11 22:17:48 +01:00
Martin Panter
2eb819f7a8
Issue #25523 : Merge "a" to "an" fixes from 3.4 into 3.5
2015-11-02 04:04:57 +00:00
Martin Panter
7462b64911
Issue #25523 : Correct "a" article to "an" article
...
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Berker Peksag
619b283d85
Use print function in mock docs.
2015-09-10 21:41:52 +03:00
Berker Peksag
920f6db10b
Use print function in mock docs.
2015-09-10 21:41:15 +03:00
Robert Collins
f79dfe3f25
Add versionchanged information for mock_open.
2015-07-24 04:09:59 +12:00
Robert Collins
ca647ef60a
Issue #21750 : Further fixup to be styled like other mock APIs.
2015-07-24 03:48:20 +12:00