From: Dong-hee Na Date: Thu, 21 Oct 2021 22:58:04 +0000 (+0900) Subject: bpo-44019: Add test_all_exported_names for operator module (GH-29124) X-Git-Tag: v3.11.0a2~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37fad7d3b7154c44b9902a2ab0db8641f1a0284b;p=thirdparty%2FPython%2Fcpython.git bpo-44019: Add test_all_exported_names for operator module (GH-29124) --- diff --git a/Lib/test/test_operator.py b/Lib/test/test_operator.py index cf3439fe6fb8..b7e38c233498 100644 --- a/Lib/test/test_operator.py +++ b/Lib/test/test_operator.py @@ -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)