diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-09-21 16:35:28 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-09-21 16:35:28 (GMT) |
commit | b3d4e7fe718f82e82861ab8fbb80c60177699a8b (patch) | |
tree | f9063ee65d6b9a06dce29bc0cf2928325316799c /Lib/unittest/case.py | |
parent | 349f552507dbdd401202f36621928342030fe2a1 (diff) | |
parent | 16ea19fc6653ee4ec1be7cd0206073962119ac08 (diff) | |
download | cpython-b3d4e7fe718f82e82861ab8fbb80c60177699a8b.zip cpython-b3d4e7fe718f82e82861ab8fbb80c60177699a8b.tar.gz cpython-b3d4e7fe718f82e82861ab8fbb80c60177699a8b.tar.bz2 |
Issue #25651: Merge from 3.5
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r-- | Lib/unittest/case.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index 1e4090c..b523f73 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -17,6 +17,7 @@ from .util import (strclass, safe_repr, _count_diff_all_purpose, __unittest = True +_subtest_msg_sentinel = object() DIFF_OMITTED = ('\nDiff is %s characters long. ' 'Set self.maxDiff to None to see it.') @@ -497,7 +498,7 @@ class TestCase(object): result.addSuccess(test_case) @contextlib.contextmanager - def subTest(self, msg=None, **params): + def subTest(self, msg=_subtest_msg_sentinel, **params): """Return a context manager that will return the enclosed block of code in a subtest identified by the optional message and keyword parameters. A failure in the subtest marks the test @@ -1397,7 +1398,7 @@ class _SubTest(TestCase): def _subDescription(self): parts = [] - if self._message: + if self._message is not _subtest_msg_sentinel: parts.append("[{}]".format(self._message)) if self.params: params_desc = ', '.join( |