[Python-checkins] bpo-44019: Add test_all_exported_names for operator module (GH-29124)

corona10 webhook-mailer at python.org
Thu Oct 21 18:58:09 EDT 2021


https://github.com/python/cpython/commit/37fad7d3b7154c44b9902a2ab0db8641f1a0284b
commit: 37fad7d3b7154c44b9902a2ab0db8641f1a0284b
branch: main
author: Dong-hee Na <donghee.na at python.org>
committer: corona10 <donghee.na92 at gmail.com>
date: 2021-10-22T07:58:04+09:00
summary:

bpo-44019: Add test_all_exported_names for operator module (GH-29124)

files:
M Lib/test/test_operator.py

diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py
index cf3439fe6fb82..b7e38c2334987 100644
--- a/Lib/test/test_operator.py
+++ b/Lib/test/test_operator.py
@@ -45,6 +45,18 @@ def __iter__(self):
 
 
 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)



More information about the Python-checkins mailing list