bpo-39450 Stripped whitespace before parsing the docstring in TestCase.shortDescription (GH-18175) (#18323)

(cherry picked from commit 032de7324e30c6b44ef272cea3be205a3d768759)

Co-authored-by: Steve Cirelli <scirelli+git@gmail.com>
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index b639c64..e5734b6 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -529,7 +529,7 @@
         the specified test method's docstring.
         """
         doc = self._testMethodDoc
-        return doc and doc.split("\n")[0].strip() or None
+        return doc.strip().split("\n")[0].strip() if doc else None
 
 
     def id(self):