summaryrefslogtreecommitdiffstats
path: root/Lib/test/test___future__.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-18 20:18:49 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-18 20:18:49 (GMT)
commitaa32070f4d7b7151974e70b407b0f0dc2a836313 (patch)
tree20ea4d8e13d5dfa5f861f37be3963cd2a1874dd2 /Lib/test/test___future__.py
parent95618b5bc98ca9f30ed9dd2e4382fd737bbbbc6c (diff)
downloadcpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.zip
cpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.tar.gz
cpython-aa32070f4d7b7151974e70b407b0f0dc2a836313.tar.bz2
Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way"). Fiddle __future__.py to use them. Jeremy's pyassem.py may also want to use them (by-hand duplication of magic numbers is brittle), but leaving that to his judgment. Beef up __future__'s test to verify the exported feature names appear correct.
Diffstat (limited to 'Lib/test/test___future__.py')
-rw-r--r--Lib/test/test___future__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test___future__.py b/Lib/test/test___future__.py
index 1897c14..fa8224f 100644
--- a/Lib/test/test___future__.py
+++ b/Lib/test/test___future__.py
@@ -6,6 +6,19 @@ import __future__
GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
features = __future__.all_feature_names
+
+# Verify that all_feature_names appears correct.
+given_feature_names = features[:]
+for name in dir(__future__):
+ obj = getattr(__future__, name, None)
+ if obj is not None and isinstance(obj, __future__._Feature):
+ verify(name in given_feature_names,
+ "%r should have been in all_feature_names" % name)
+ given_feature_names.remove(name)
+verify(len(given_feature_names) == 0,
+ "all_feature_names has too much: %r" % given_feature_names)
+del given_feature_names
+
for feature in features:
value = getattr(__future__, feature)
if verbose: