summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-03-31 07:22:55 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-03-31 07:22:55 -0400
commit8ce3ce1b516b61c7425694d32b8fcd482abe0a05 (patch)
treede743e83d222b0dd0e043941f4de1d2b26269d95
parent16f8ce06ed8f3db7c284db5946179c6f58942f2f (diff)
downloadpython-coveragepy-8ce3ce1b516b61c7425694d32b8fcd482abe0a05.tar.gz
A different way to group builtins, because it's fun, why not?
-rw-r--r--tests/modules/process_test/try_execfile.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/modules/process_test/try_execfile.py b/tests/modules/process_test/try_execfile.py
index ec7dcbe..3068327 100644
--- a/tests/modules/process_test/try_execfile.py
+++ b/tests/modules/process_test/try_execfile.py
@@ -68,10 +68,15 @@ FN_VAL = my_function("fooey")
loader = globals().get('__loader__')
fullname = getattr(loader, 'fullname', None) or getattr(loader, 'name', None)
-# A more compact grouped-by-first-letter list of builtins.
+# A more compact ad-hoc grouped-by-first-letter list of builtins.
+CLUMPS = "ABC,DEF,GHI,JKLMN,OPQR,ST,U,VWXYZ_,ab,cd,efg,hij,lmno,pqr,stuvwxyz".split(",")
+
def word_group(w):
- """Clump AB, CD, EF, etc."""
- return chr((ord(w[0]) + 1) & 0xFE)
+ """Figure out which CLUMP the first letter of w is in."""
+ for i, clump in enumerate(CLUMPS):
+ if w[0] in clump:
+ return i
+ return 99
builtin_dir = [" ".join(s) for _, s in itertools.groupby(dir(__builtins__), key=word_group)]