Ron
032a6480e3
Update TestCase.assertAlmostEqual and assertNotAlmostEqual docstrings. (GH-3998)
...
The word "difference" from missing the sentence.
This clarifies that it compares the difference between the two objects.
2017-10-18 10:01:23 -07: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
Serhiy Storchaka
0b5e61ddca
bpo-30397: Add re.Pattern and re.Match. ( #1646 )
2017-10-04 20:09:49 +03:00
Ville Skyttä
49b2734bf1
Spelling fixes ( #2902 )
2017-08-03 09:00:59 +03:00
Aaron Gallagher
856cbcc12f
bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions (GH-3)
...
Cython will, in the right circumstances, offer a MethodType instance
where im_func is a builtin function. Any instance of MethodType is
automatically assumed to be a Python-defined function (more
specifically, a function that has an inspectable signature), but
_set_signature was still conservative in its assumptions. As a result
_set_signature would return early with None instead of a mock since
the im_func had no inspectable signature. This causes problems
deeper inside mock, as _set_signature is assumed to _always_
return a mock, and nothing checked its return value.
In similar corner cases, autospec will simply not check the spec of the
function, so _set_signature is amended to now return early with the
original, not-wrapped mock object.
Patch by Aaron Gallagher.
2017-07-20 03:01:14 +03:00
Victor Stinner
e4f9a2d2be
bpo-30813: Fix unittest when hunting refleaks ( #2502 )
...
bpo-11798, bpo-16662, bpo-16935, bpo-30813: Skip
test_discover_with_module_that_raises_SkipTest_on_import() and
test_discover_with_init_module_that_raises_SkipTest_on_import() of
test_unittest when hunting reference leaks using regrtest.
2017-06-30 12:52:52 +02:00
Serhiy Storchaka
48fbe52ac7
bpo-30664: The description of a unittest subtest now preserves the ( #2265 )
...
order of keyword arguments of TestCase.subTest().
2017-06-23 21:47:39 +03:00
Giampaolo Rodola
c4750959ac
#30190 : fix invalid escape sequence warnings ( #1534 )
2017-05-10 20:13:20 +02:00
Giampaolo Rodola
5d7a8d0c13
bpo-30190: improved error msg for assertAlmostEqual(delta=...) ( #1331 )
...
* #30190 / unittest / assertAlmostEqual(delta=...) / error msg: show the difference between the 2 numbers in case of failure
* safe_repr() diff
* also show difference when passing 'places' argument
* refactoring
* update Misc/NEWS
2017-05-01 18:18:56 +02:00
Louie Lu
f7e62cf8ad
bpo-30078: Add an example of passing a path to unittest ( #1178 )
2017-04-20 06:46:59 +03:00
Serhiy Storchaka
55fe1ae970
bpo-30022: Get rid of using EnvironmentError and IOError (except test… ( #1051 )
2017-04-16 10:46:38 +03:00
Victor Stinner
bbd3cf8f1e
Fix ref cycles in TestCase.assertRaises() ( #193 )
...
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
2017-03-28 00:56:28 +02:00
Victor Stinner
d6debb24e0
bpo-29919: Remove unused imports found by pyflakes ( #137 )
...
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Berker Peksag
5aa3856b4f
bpo-28961: Address my comments from earlier code review ( #305 )
2017-02-26 15:04:11 +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
19dea2c726
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:17:25 +02:00
Serhiy Storchaka
a203360836
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:15:18 +02:00
Serhiy Storchaka
362f058a89
Issue #28735 : Fixed the comparison of mock.MagickMock with mock.ANY.
2017-01-21 23:12:58 +02:00
Martin Panter
9722d7f142
Issue 29274: Merge doc fixes from 3.6
2017-01-18 12:11:42 +00:00
Martin Panter
4710935b11
Issue 29274: Merge doc fixes from 3.5
2017-01-18 12:11:12 +00:00
Martin Panter
37f183d43d
Issue #29274 : tests cases → test cases
2017-01-18 12:06:38 +00: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
Victor Stinner
cd992bbe73
Merge 3.6
2017-01-06 18:16:07 +01:00
Victor Stinner
84b6fb0eea
Fix unittest.mock._Call: don't ignore name
...
Issue #28961 : Fix unittest.mock._Call helper: don't ignore the name parameter
anymore.
Patch written by Jiajun Huang.
2017-01-06 18:15:51 +01:00
Berker Peksag
161a4dd495
Issue #28919 : Simplify _copy_func_details() in unittest.mock
...
Patch by Jiajun Huang.
2016-12-15 05:21:44 +03:00
Gregory P. Smith
ac5084b6c7
Fixes issue28380: unittest.mock Mock autospec functions now properly support
...
assert_called, assert_not_called, and assert_called_once.
2016-10-06 14:31:23 -07:00
Berker Peksag
eadf443e9a
Issue #28303 : Merge from 3.5
2016-09-28 17:29:12 +03:00
Berker Peksag
aa5c2fdb7c
Issue #28303 : Fix grammar in unittest.__doc__, patch by Shlomi Fish
2016-09-28 17:28:41 +03:00
Berker Peksag
b3d4e7fe71
Issue #25651 : Merge from 3.5
2016-09-21 19:35:28 +03:00
Berker Peksag
16ea19fc66
Issue #25651 : Allow falsy values to be used for msg parameter of subTest()
2016-09-21 19:34:15 +03:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
R David Murray
44b548dda8
#27364 : fix "incorrect" uses of escape character in the stdlib.
...
And most of the tools.
Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Raymond Hettinger
f74c33ad5c
Merge
2016-08-25 21:12:16 -07:00
Raymond Hettinger
7ea386e56e
Issue 19504: Change "customise" to "customize" American spelling.
2016-08-25 21:11:50 -07:00
Gregory P. Smith
c35a32fe85
Issue #26750 : use inspect.isdatadescriptor instead of our own
...
_is_data_descriptor().
2016-08-15 23:56:32 -07:00
Gregory P. Smith
d4583d7fea
Issue #26750 : use inspect.isdatadescriptor instead of our own
...
_is_data_descriptor().
2016-08-15 23:23:40 -07:00
Gregory P. Smith
d0d24fd1ae
Issue #26750 : unittest.mock.create_autospec() now works properly for
...
subclasses of property() and other data descriptors. Removes the never
publicly used, never documented unittest.mock.DescriptorTypes tuple.
2016-08-07 09:06:27 -07:00
Gregory P. Smith
9854789efe
Issue #26750 : unittest.mock.create_autospec() now works properly
...
for subclasses of property() and other data descriptors.
2016-08-07 08:52:26 -07:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Martin Panter
702f4f5d6f
Issue #23804 : Merge spelling and NEWS fixes from 3.5
2016-07-11 12:54:44 +00:00
Martin Panter
204bf0b9ae
English spelling and grammar fixes
2016-07-11 07:51:37 +00:00
Berker Peksag
a9e1ebb780
Issue #27430 : Merge from 3.5
2016-07-01 12:17:45 +03:00
Berker Peksag
e39682b076
Issue #27430 : Fix typos, patch by scop.
2016-07-01 12:17:05 +03:00
Serhiy Storchaka
6c85091b5b
Issue #23641 : Added __getnewargs_ex__ to the list of special mock attributes.
2016-06-19 18:32:07 +03:00
Serhiy Storchaka
5943ea76d5
Issue #23641 : Added __getnewargs_ex__ to the list of special mock attributes.
2016-06-19 18:30:43 +03: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
Martin Panter
0b7d84de6b
Issue #27171 : Merge typo fixes from 3.5
2016-06-02 10:11:18 +00:00
Martin Panter
e26da7c03a
Issue #27171 : Fix typos in documentation, comments, and test function names
2016-06-02 10:07:09 +00:00