@@ -423,32 +423,34 @@ def testGetDescriptionWithoutDocstring(self):
423423 self .assertEqual (
424424 result .getDescription (self ),
425425 'testGetDescriptionWithoutDocstring (' + __name__ +
426- '.Test_TextTestResult)' )
426+ '.Test_TextTestResult.testGetDescriptionWithoutDocstring )' )
427427
428428 def testGetSubTestDescriptionWithoutDocstring (self ):
429429 with self .subTest (foo = 1 , bar = 2 ):
430430 result = unittest .TextTestResult (None , True , 1 )
431431 self .assertEqual (
432432 result .getDescription (self ._subtest ),
433433 'testGetSubTestDescriptionWithoutDocstring (' + __name__ +
434- '.Test_TextTestResult) (foo=1, bar=2)' )
434+ '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstring) (foo=1, bar=2)' )
435+
435436 with self .subTest ('some message' ):
436437 result = unittest .TextTestResult (None , True , 1 )
437438 self .assertEqual (
438439 result .getDescription (self ._subtest ),
439440 'testGetSubTestDescriptionWithoutDocstring (' + __name__ +
440- '.Test_TextTestResult) [some message]' )
441+ '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstring ) [some message]' )
441442
442443 def testGetSubTestDescriptionWithoutDocstringAndParams (self ):
443444 with self .subTest ():
444445 result = unittest .TextTestResult (None , True , 1 )
445446 self .assertEqual (
446447 result .getDescription (self ._subtest ),
447448 'testGetSubTestDescriptionWithoutDocstringAndParams '
448- '(' + __name__ + '.Test_TextTestResult) (<subtest>)' )
449+ '(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) '
450+ '(<subtest>)' )
449451
450452 def testGetSubTestDescriptionForFalsyValues (self ):
451- expected = 'testGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult) [%s]'
453+ expected = 'testGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalsyValues ) [%s]'
452454 result = unittest .TextTestResult (None , True , 1 )
453455 for arg in [0 , None , []]:
454456 with self .subTest (arg ):
@@ -464,7 +466,8 @@ def testGetNestedSubTestDescriptionWithoutDocstring(self):
464466 self .assertEqual (
465467 result .getDescription (self ._subtest ),
466468 'testGetNestedSubTestDescriptionWithoutDocstring '
467- '(' + __name__ + '.Test_TextTestResult) (baz=2, bar=3, foo=1)' )
469+ '(' + __name__ + '.Test_TextTestResult.testGetNestedSubTestDescriptionWithoutDocstring) '
470+ '(baz=2, bar=3, foo=1)' )
468471
469472 def testGetDuplicatedNestedSubTestDescriptionWithoutDocstring (self ):
470473 with self .subTest (foo = 1 , bar = 2 ):
@@ -473,7 +476,7 @@ def testGetDuplicatedNestedSubTestDescriptionWithoutDocstring(self):
473476 self .assertEqual (
474477 result .getDescription (self ._subtest ),
475478 'testGetDuplicatedNestedSubTestDescriptionWithoutDocstring '
476- '(' + __name__ + '.Test_TextTestResult) (baz=3, bar=4, foo=1)' )
479+ '(' + __name__ + '.Test_TextTestResult.testGetDuplicatedNestedSubTestDescriptionWithoutDocstring ) (baz=3, bar=4, foo=1)' )
477480
478481 @unittest .skipIf (sys .flags .optimize >= 2 ,
479482 "Docstrings are omitted with -O2 and above" )
@@ -483,7 +486,7 @@ def testGetDescriptionWithOneLineDocstring(self):
483486 self .assertEqual (
484487 result .getDescription (self ),
485488 ('testGetDescriptionWithOneLineDocstring '
486- '(' + __name__ + '.Test_TextTestResult)\n '
489+ '(' + __name__ + '.Test_TextTestResult.testGetDescriptionWithOneLineDocstring )\n '
487490 'Tests getDescription() for a method with a docstring.' ))
488491
489492 @unittest .skipIf (sys .flags .optimize >= 2 ,
@@ -495,7 +498,9 @@ def testGetSubTestDescriptionWithOneLineDocstring(self):
495498 self .assertEqual (
496499 result .getDescription (self ._subtest ),
497500 ('testGetSubTestDescriptionWithOneLineDocstring '
498- '(' + __name__ + '.Test_TextTestResult) (foo=1, bar=2)\n '
501+ '(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithOneLineDocstring) '
502+ '(foo=1, bar=2)\n '
503+
499504 'Tests getDescription() for a method with a docstring.' ))
500505
501506 @unittest .skipIf (sys .flags .optimize >= 2 ,
@@ -508,7 +513,7 @@ def testGetDescriptionWithMultiLineDocstring(self):
508513 self .assertEqual (
509514 result .getDescription (self ),
510515 ('testGetDescriptionWithMultiLineDocstring '
511- '(' + __name__ + '.Test_TextTestResult)\n '
516+ '(' + __name__ + '.Test_TextTestResult.testGetDescriptionWithMultiLineDocstring )\n '
512517 'Tests getDescription() for a method with a longer '
513518 'docstring.' ))
514519
@@ -523,7 +528,8 @@ def testGetSubTestDescriptionWithMultiLineDocstring(self):
523528 self .assertEqual (
524529 result .getDescription (self ._subtest ),
525530 ('testGetSubTestDescriptionWithMultiLineDocstring '
526- '(' + __name__ + '.Test_TextTestResult) (foo=1, bar=2)\n '
531+ '(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithMultiLineDocstring) '
532+ '(foo=1, bar=2)\n '
527533 'Tests getDescription() for a method with a longer '
528534 'docstring.' ))
529535
@@ -582,36 +588,36 @@ def testDotsOutput(self):
582588 def testLongOutput (self ):
583589 classname = f'{ __name__ } .{ self .Test .__qualname__ } '
584590 self .assertEqual (self ._run_test ('testSuccess' , 2 ),
585- f'testSuccess ({ classname } ) ... ok\n ' )
591+ f'testSuccess ({ classname } .testSuccess ) ... ok\n ' )
586592 self .assertEqual (self ._run_test ('testSkip' , 2 ),
587- f"testSkip ({ classname } ) ... skipped 'skip'\n " )
593+ f"testSkip ({ classname } .testSkip ) ... skipped 'skip'\n " )
588594 self .assertEqual (self ._run_test ('testFail' , 2 ),
589- f'testFail ({ classname } ) ... FAIL\n ' )
595+ f'testFail ({ classname } .testFail ) ... FAIL\n ' )
590596 self .assertEqual (self ._run_test ('testError' , 2 ),
591- f'testError ({ classname } ) ... ERROR\n ' )
597+ f'testError ({ classname } .testError ) ... ERROR\n ' )
592598 self .assertEqual (self ._run_test ('testExpectedFailure' , 2 ),
593- f'testExpectedFailure ({ classname } ) ... expected failure\n ' )
599+ f'testExpectedFailure ({ classname } .testExpectedFailure ) ... expected failure\n ' )
594600 self .assertEqual (self ._run_test ('testUnexpectedSuccess' , 2 ),
595- f'testUnexpectedSuccess ({ classname } ) ... unexpected success\n ' )
601+ f'testUnexpectedSuccess ({ classname } .testUnexpectedSuccess ) ... unexpected success\n ' )
596602
597603 def testDotsOutputSubTestSuccess (self ):
598604 self .assertEqual (self ._run_test ('testSubTestSuccess' , 1 ), '.' )
599605
600606 def testLongOutputSubTestSuccess (self ):
601607 classname = f'{ __name__ } .{ self .Test .__qualname__ } '
602608 self .assertEqual (self ._run_test ('testSubTestSuccess' , 2 ),
603- f'testSubTestSuccess ({ classname } ) ... ok\n ' )
609+ f'testSubTestSuccess ({ classname } .testSubTestSuccess ) ... ok\n ' )
604610
605611 def testDotsOutputSubTestMixed (self ):
606612 self .assertEqual (self ._run_test ('testSubTestMixed' , 1 ), 'sFE' )
607613
608614 def testLongOutputSubTestMixed (self ):
609615 classname = f'{ __name__ } .{ self .Test .__qualname__ } '
610616 self .assertEqual (self ._run_test ('testSubTestMixed' , 2 ),
611- f'testSubTestMixed ({ classname } ) ... \n '
612- f" testSubTestMixed ({ classname } ) [skip] (b=2) ... skipped 'skip'\n "
613- f' testSubTestMixed ({ classname } ) [fail] (c=3) ... FAIL\n '
614- f' testSubTestMixed ({ classname } ) [error] (d=4) ... ERROR\n ' )
617+ f'testSubTestMixed ({ classname } .testSubTestMixed ) ... \n '
618+ f" testSubTestMixed ({ classname } .testSubTestMixed ) [skip] (b=2) ... skipped 'skip'\n "
619+ f' testSubTestMixed ({ classname } .testSubTestMixed ) [fail] (c=3) ... FAIL\n '
620+ f' testSubTestMixed ({ classname } .testSubTestMixed ) [error] (d=4) ... ERROR\n ' )
615621
616622 def testDotsOutputTearDownFail (self ):
617623 out = self ._run_test ('testSuccess' , 1 , AssertionError ('fail' ))
@@ -627,19 +633,19 @@ def testLongOutputTearDownFail(self):
627633 classname = f'{ __name__ } .{ self .Test .__qualname__ } '
628634 out = self ._run_test ('testSuccess' , 2 , AssertionError ('fail' ))
629635 self .assertEqual (out ,
630- f'testSuccess ({ classname } ) ... FAIL\n ' )
636+ f'testSuccess ({ classname } .testSuccess ) ... FAIL\n ' )
631637 out = self ._run_test ('testError' , 2 , AssertionError ('fail' ))
632638 self .assertEqual (out ,
633- f'testError ({ classname } ) ... ERROR\n '
634- f'testError ({ classname } ) ... FAIL\n ' )
639+ f'testError ({ classname } .testError ) ... ERROR\n '
640+ f'testError ({ classname } .testError ) ... FAIL\n ' )
635641 out = self ._run_test ('testFail' , 2 , Exception ('error' ))
636642 self .assertEqual (out ,
637- f'testFail ({ classname } ) ... FAIL\n '
638- f'testFail ({ classname } ) ... ERROR\n ' )
643+ f'testFail ({ classname } .testFail ) ... FAIL\n '
644+ f'testFail ({ classname } .testFail ) ... ERROR\n ' )
639645 out = self ._run_test ('testSkip' , 2 , AssertionError ('fail' ))
640646 self .assertEqual (out ,
641- f"testSkip ({ classname } ) ... skipped 'skip'\n "
642- f'testSkip ({ classname } ) ... FAIL\n ' )
647+ f"testSkip ({ classname } .testSkip ) ... skipped 'skip'\n "
648+ f'testSkip ({ classname } .testSkip ) ... FAIL\n ' )
643649
644650
645651classDict = dict (unittest .TestResult .__dict__ )
@@ -852,7 +858,7 @@ def test_foo(self):
852858 expected_out = '\n Stdout:\n set up\n '
853859 self .assertEqual (stdout .getvalue (), expected_out )
854860 self .assertEqual (len (result .errors ), 1 )
855- description = f'test_foo ({ strclass (Foo )} )'
861+ description = f'test_foo ({ strclass (Foo )} .test_foo )'
856862 test_case , formatted_exc = result .errors [0 ]
857863 self .assertEqual (str (test_case ), description )
858864 self .assertIn ('ZeroDivisionError: division by zero' , formatted_exc )
@@ -874,7 +880,7 @@ def test_foo(self):
874880 expected_out = '\n Stdout:\n tear down\n '
875881 self .assertEqual (stdout .getvalue (), expected_out )
876882 self .assertEqual (len (result .errors ), 1 )
877- description = f'test_foo ({ strclass (Foo )} )'
883+ description = f'test_foo ({ strclass (Foo )} .test_foo )'
878884 test_case , formatted_exc = result .errors [0 ]
879885 self .assertEqual (str (test_case ), description )
880886 self .assertIn ('ZeroDivisionError: division by zero' , formatted_exc )
@@ -897,7 +903,7 @@ def test_foo(self):
897903 expected_out = '\n Stdout:\n set up\n do cleanup2\n do cleanup1\n '
898904 self .assertEqual (stdout .getvalue (), expected_out )
899905 self .assertEqual (len (result .errors ), 2 )
900- description = f'test_foo ({ strclass (Foo )} )'
906+ description = f'test_foo ({ strclass (Foo )} .test_foo )'
901907 test_case , formatted_exc = result .errors [0 ]
902908 self .assertEqual (str (test_case ), description )
903909 self .assertIn ('ValueError: bad cleanup2' , formatted_exc )
@@ -928,7 +934,7 @@ def test_foo(self):
928934 expected_out = '\n Stdout:\n set up\n do cleanup2\n do cleanup1\n '
929935 self .assertEqual (stdout .getvalue (), expected_out )
930936 self .assertEqual (len (result .errors ), 3 )
931- description = f'test_foo ({ strclass (Foo )} )'
937+ description = f'test_foo ({ strclass (Foo )} .test_foo )'
932938 test_case , formatted_exc = result .errors [0 ]
933939 self .assertEqual (str (test_case ), description )
934940 self .assertIn ('ZeroDivisionError: division by zero' , formatted_exc )
@@ -971,7 +977,7 @@ def test_foo(self):
971977 expected_out = '\n Stdout:\n set up\n tear down\n do cleanup2\n do cleanup1\n '
972978 self .assertEqual (stdout .getvalue (), expected_out )
973979 self .assertEqual (len (result .errors ), 3 )
974- description = f'test_foo ({ strclass (Foo )} )'
980+ description = f'test_foo ({ strclass (Foo )} .test_foo )'
975981 test_case , formatted_exc = result .errors [0 ]
976982 self .assertEqual (str (test_case ), description )
977983 self .assertIn ('ZeroDivisionError: division by zero' , formatted_exc )
0 commit comments