Name this list of accepted symbol differences

This should make it easier to add new entries as well as clarifying
the intent of this filter.
This commit is contained in:
Peter Law
2024-06-23 12:51:23 +01:00
parent 68e435cc66
commit ee90cd97b6

View File

@@ -73,15 +73,19 @@ class TestSetupReadline(unittest.TestCase):
import os
s = 'from os import '
goal = {s + el for el in dir(os)}
# There are minor differences, e.g. the dir doesn't include deleted
# items as well as items that are not only available on linux.
difference = set(self.complete(s)).symmetric_difference(goal)
ACCEPTED_DIFFERENCE_PREFIXES = [
'_', 'O_', 'EX_', 'MFD_',
'SF_', 'ST_', 'CLD_', 'POSIX_SPAWN_', 'P_',
'RWF_', 'CLONE_', 'SCHED_',
]
difference = {
x for x in difference
if all(not x.startswith('from os import ' + s)
for s in ['_', 'O_', 'EX_', 'MFD_', 'SF_', 'ST_',
'CLD_', 'POSIX_SPAWN_', 'P_', 'RWF_',
'CLONE_', 'SCHED_'])
if all(not x.startswith('from os import ' + prefix)
for prefix in ACCEPTED_DIFFERENCE_PREFIXES)
}
# There are quite a few differences, because both Windows and Linux
# (posix and nt) libraries are included.