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
commite4dd841be689c46f6104780d7619bdfe4213a8a8 (patch)
treea0767af26687d0fbce6388fe1e35bfd29fe6d5f5
parentfec75c18a87e8acf8a0d4f978b2ef4e1cea755de (diff)
downloadpython-coveragepy-git-e4dd841be689c46f6104780d7619bdfe4213a8a8.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 ec7dcbe5..3068327e 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)]