Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-44019: Add test_all_exported_names for operator module #29124

Merged
merged 2 commits into from
Oct 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Lib/test/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ def __iter__(self):


class OperatorTestCase:
def test_all_exported_names(self):
corona10 marked this conversation as resolved.
Show resolved Hide resolved
operator = self.module
actual_all = set(operator.__all__)
computed_all = set()
for k in vars(operator):
corona10 marked this conversation as resolved.
Show resolved Hide resolved
if k.startswith('__'):
continue
value = getattr(operator, k)
if value.__module__ in ('operator', '_operator'):
computed_all.add(k)
self.assertSetEqual(computed_all, actual_all)

def test_lt(self):
operator = self.module
self.assertRaises(TypeError, operator.lt)
Expand Down