diff options
author | Robert Collins <rbtcollins@hp.com> | 2014-10-30 08:16:28 +1300 |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2014-10-30 08:16:28 +1300 |
commit | c1345840202fed6f1405efec97cd2a147aa5a92e (patch) | |
tree | 6a95812cfdf4f07a17f47ae678a3985794c8da30 /Lib/unittest/test/test_case.py | |
parent | 3b6bd645206abca069aee790e9926066e484225e (diff) | |
download | cpython-git-c1345840202fed6f1405efec97cd2a147aa5a92e.tar.gz |
Close #22756: Improve the test output for some assertEqual tests.
These tests were undebuggable as written, and there's no testing fallacy
involved in using the method we're testing to test the output of that method,
so switch to that.
Diffstat (limited to 'Lib/unittest/test/test_case.py')
-rw-r--r-- | Lib/unittest/test/test_case.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py index a34259554d..c4a100c2d6 100644 --- a/Lib/unittest/test/test_case.py +++ b/Lib/unittest/test/test_case.py @@ -1075,10 +1075,7 @@ test case except self.failureException as e: # need to remove the first line of the error message error = str(e).split('\n', 1)[1] - - # no fair testing ourself with ourself, and assertEqual is used for strings - # so can't use assertEqual either. Just use assertTrue. - self.assertTrue(sample_text_error == error) + self.assertEqual(sample_text_error, error) def testAssertEqualSingleLine(self): sample_text = "laden swallows fly slowly" @@ -1092,8 +1089,9 @@ test case try: self.assertEqual(sample_text, revised_sample_text) except self.failureException as e: + # need to remove the first line of the error message error = str(e).split('\n', 1)[1] - self.assertTrue(sample_text_error == error) + self.assertEqual(sample_text_error, error) def testAssertIsNone(self): self.assertIsNone(None) |