@@ -307,7 +307,7 @@ def testGetSubTestDescriptionWithoutDocstring(self):
307307 self .assertEqual (
308308 result .getDescription (self ._subtest ),
309309 'testGetSubTestDescriptionWithoutDocstring (' + __name__ +
310- '.Test_TestResult) (bar=2, foo=1 )' )
310+ '.Test_TestResult) (foo=1, bar=2 )' )
311311 with self .subTest ('some message' ):
312312 result = unittest .TextTestResult (None , True , 1 )
313313 self .assertEqual (
@@ -335,12 +335,21 @@ def testGetSubTestDescriptionForFalsyValues(self):
335335
336336 def testGetNestedSubTestDescriptionWithoutDocstring (self ):
337337 with self .subTest (foo = 1 ):
338- with self .subTest (bar = 2 ):
338+ with self .subTest (baz = 2 , bar = 3 ):
339339 result = unittest .TextTestResult (None , True , 1 )
340340 self .assertEqual (
341341 result .getDescription (self ._subtest ),
342342 'testGetNestedSubTestDescriptionWithoutDocstring '
343- '(' + __name__ + '.Test_TestResult) (bar=2, foo=1)' )
343+ '(' + __name__ + '.Test_TestResult) (baz=2, bar=3, foo=1)' )
344+
345+ def testGetDuplicatedNestedSubTestDescriptionWithoutDocstring (self ):
346+ with self .subTest (foo = 1 , bar = 2 ):
347+ with self .subTest (baz = 3 , bar = 4 ):
348+ result = unittest .TextTestResult (None , True , 1 )
349+ self .assertEqual (
350+ result .getDescription (self ._subtest ),
351+ 'testGetDuplicatedNestedSubTestDescriptionWithoutDocstring '
352+ '(' + __name__ + '.Test_TestResult) (baz=3, bar=4, foo=1)' )
344353
345354 @unittest .skipIf (sys .flags .optimize >= 2 ,
346355 "Docstrings are omitted with -O2 and above" )
@@ -362,7 +371,7 @@ def testGetSubTestDescriptionWithOneLineDocstring(self):
362371 self .assertEqual (
363372 result .getDescription (self ._subtest ),
364373 ('testGetSubTestDescriptionWithOneLineDocstring '
365- '(' + __name__ + '.Test_TestResult) (bar=2, foo=1 )\n '
374+ '(' + __name__ + '.Test_TestResult) (foo=1, bar=2 )\n '
366375 'Tests getDescription() for a method with a docstring.' ))
367376
368377 @unittest .skipIf (sys .flags .optimize >= 2 ,
@@ -390,7 +399,7 @@ def testGetSubTestDescriptionWithMultiLineDocstring(self):
390399 self .assertEqual (
391400 result .getDescription (self ._subtest ),
392401 ('testGetSubTestDescriptionWithMultiLineDocstring '
393- '(' + __name__ + '.Test_TestResult) (bar=2, foo=1 )\n '
402+ '(' + __name__ + '.Test_TestResult) (foo=1, bar=2 )\n '
394403 'Tests getDescription() for a method with a longer '
395404 'docstring.' ))
396405
0 commit comments