Kaydet (Commit) 40e1ffc7 authored tarafından R David Murray's avatar R David Murray

whatsnew: fix unittest subtest example.

üst 97c36425
...@@ -1642,7 +1642,7 @@ which will run even if one or more of them fail. For example:: ...@@ -1642,7 +1642,7 @@ which will run even if one or more of them fail. For example::
class NumbersTest(unittest.TestCase): class NumbersTest(unittest.TestCase):
def test_even(self): def test_even(self):
for i in range(6): for i in range(6):
with self.subTest(i=1): with self.subTest(i=i):
self.assertEqual(i % 2, 0) self.assertEqual(i % 2, 0)
will result in six subtests, each identified in the unittest verbose output will result in six subtests, each identified in the unittest verbose output
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment