Jackson Riley
9f2fb4262f
Update unittest.mock docs
2020-11-10 13:03:31 +00: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
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