]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44019: Add test_all_exported_names for operator module (GH-29124)
authorDong-hee Na <donghee.na@python.org>
Thu, 21 Oct 2021 22:58:04 +0000 (07:58 +0900)
committerGitHub <noreply@github.com>
Thu, 21 Oct 2021 22:58:04 +0000 (07:58 +0900)
Lib/test/test_operator.py

index cf3439fe6fb82fab20583ea368060624e13cff55..b7e38c2334987828dea4f017828d678f2d9163c0 100644 (file)
@@ -45,6 +45,18 @@ class BadIterable:
 
 
 class OperatorTestCase:
+    def test___all__(self):
+        operator = self.module
+        actual_all = set(operator.__all__)
+        computed_all = set()
+        for name in vars(operator):
+            if name.startswith('__'):
+                continue
+            value = getattr(operator, name)
+            if value.__module__ in ('operator', '_operator'):
+                computed_all.add(name)
+        self.assertSetEqual(computed_all, actual_all)
+
     def test_lt(self):
         operator = self.module
         self.assertRaises(TypeError, operator.lt)