@@ -307,7 +307,7 @@ def testGetSubTestDescriptionWithoutDocstring(self):
307
307
self .assertEqual (
308
308
result .getDescription (self ._subtest ),
309
309
'testGetSubTestDescriptionWithoutDocstring (' + __name__ +
310
- '.Test_TestResult) (bar=2, foo=1 )' )
310
+ '.Test_TestResult) (foo=1, bar=2 )' )
311
311
with self .subTest ('some message' ):
312
312
result = unittest .TextTestResult (None , True , 1 )
313
313
self .assertEqual (
@@ -335,12 +335,21 @@ def testGetSubTestDescriptionForFalsyValues(self):
335
335
336
336
def testGetNestedSubTestDescriptionWithoutDocstring (self ):
337
337
with self .subTest (foo = 1 ):
338
- with self .subTest (bar = 2 ):
338
+ with self .subTest (baz = 2 , bar = 3 ):
339
339
result = unittest .TextTestResult (None , True , 1 )
340
340
self .assertEqual (
341
341
result .getDescription (self ._subtest ),
342
342
'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)' )
344
353
345
354
@unittest .skipIf (sys .flags .optimize >= 2 ,
346
355
"Docstrings are omitted with -O2 and above" )
@@ -362,7 +371,7 @@ def testGetSubTestDescriptionWithOneLineDocstring(self):
362
371
self .assertEqual (
363
372
result .getDescription (self ._subtest ),
364
373
('testGetSubTestDescriptionWithOneLineDocstring '
365
- '(' + __name__ + '.Test_TestResult) (bar=2, foo=1 )\n '
374
+ '(' + __name__ + '.Test_TestResult) (foo=1, bar=2 )\n '
366
375
'Tests getDescription() for a method with a docstring.' ))
367
376
368
377
@unittest .skipIf (sys .flags .optimize >= 2 ,
@@ -390,7 +399,7 @@ def testGetSubTestDescriptionWithMultiLineDocstring(self):
390
399
self .assertEqual (
391
400
result .getDescription (self ._subtest ),
392
401
('testGetSubTestDescriptionWithMultiLineDocstring '
393
- '(' + __name__ + '.Test_TestResult) (bar=2, foo=1 )\n '
402
+ '(' + __name__ + '.Test_TestResult) (foo=1, bar=2 )\n '
394
403
'Tests getDescription() for a method with a longer '
395
404
'docstring.' ))
396
405
0 commit comments