From ee90cd97b614f02460e82a250ff8e26a35d23f8d Mon Sep 17 00:00:00 2001 From: Peter Law Date: Sun, 23 Jun 2024 12:51:23 +0100 Subject: [PATCH] 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. --- test/test_utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index acc1df9c..31637d47 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -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.