chiark / gitweb /
documentation/python: don't use test skipping for version branching.
authorVladimír Vondruš <mosra@centrum.cz>
Sat, 14 Sep 2024 21:25:30 +0000 (23:25 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 14 Sep 2024 23:48:41 +0000 (01:48 +0200)
So much duplication, ew.

documentation/test_python/test_inspect.py

index a975fd4f21e5220a3af709de3b51849f8155442e..bc663b0ac3e2196778dcb066b67a22afdffc0491 100644 (file)
@@ -98,60 +98,30 @@ class Annotations(BaseInspectTestCase):
         else:
             self.assertEqual(*self.actual_expected_contents('inspect_annotations.AContainer.html', 'inspect_annotations.AContainer-py36-38.html'))
 
-    # https://github.com/python/cpython/pull/13394
-    @unittest.skipUnless(sys.version_info >= (3, 7, 4),
-        "signature with / for pow() is not present in 3.6, "
-        "3.7.3 and below has a different docstring")
     def test_math(self):
-        # From math export only pow() so we have the verification easier, and
-        # in addition log() because it doesn't provide any signature metadata
-        assert not hasattr(math, '__all__')
-        math.__all__ = ['pow', 'log']
-
-        self.run_python({
-            'INPUT_MODULES': [math]
-        })
-
-        del math.__all__
-        assert not hasattr(math, '__all__')
-
-        self.assertEqual(*self.actual_expected_contents('math.html'))
-
-    # https://github.com/python/cpython/pull/13394
-    @unittest.skipUnless(sys.version_info < (3, 7, 4) and sys.version_info >= (3, 7),
-        "signature with / for pow() is not present in 3.6, "
-        "3.7.3 and below has a different docstring")
-    def test_math373(self):
-        # From math export only pow() so we have the verification easier, and
-        # in addition log() because it doesn't provide any signature metadata
-        assert not hasattr(math, '__all__')
-        math.__all__ = ['pow', 'log']
-
-        self.run_python({
-            'INPUT_MODULES': [math]
-        })
-
-        del math.__all__
-        assert not hasattr(math, '__all__')
-
-        self.assertEqual(*self.actual_expected_contents('math.html', 'math373.html'))
-
-    @unittest.skipUnless(sys.version_info < (3, 7),
-        "docstring for log() is different in 3.7")
-    def test_math36(self):
         # From math export only pow() so we have the verification easier, and
         # in addition log() because it doesn't provide any signature metadata
         assert not hasattr(math, '__all__')
         math.__all__ = ['log']
+        # signature with / for pow() is not present in 3.6 so it makes no sense
+        # to have it
+        if sys.version_info >= (3, 7):
+            math.__all__ = ['pow'] + math.__all__
 
         self.run_python({
             'INPUT_MODULES': [math]
         })
 
-        del math.__all__
-        assert not hasattr(math, '__all__')
-
-        self.assertEqual(*self.actual_expected_contents('math.html', 'math36.html'))
+        if sys.version_info >= (3, 7, 4):
+            file = 'math.html'
+        # 3.7.3 and below has a different docstring
+        # https://github.com/python/cpython/pull/13394
+        elif sys.version_info >= (3, 7):
+            file = 'math373.html'
+        # signature with / for pow() is not present in 3.6
+        else:
+            file = 'math36.html'
+        self.assertEqual(*self.actual_expected_contents('math.html', file))
 
 class NameMapping(BaseInspectTestCase):
     def test(self):