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

This commit is contained in:
Dong-hee Na 2021-10-22 07:58:04 +09:00 committed by GitHub
parent d1b24775b4
commit 37fad7d3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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)