[Python-checkins] CVS: python/dist/src/Lib/test test___future__.py,1.3,1.4
Tim Peters
tim_one@users.sourceforge.net
Sat, 18 Aug 2001 13:18:51 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv5565/python/Lib/test
Modified Files:
test___future__.py
Log Message:
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.
Index: test___future__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test___future__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test___future__.py 2001/08/17 19:49:02 1.3
--- test___future__.py 2001/08/18 20:18:49 1.4
***************
*** 7,10 ****
--- 7,23 ----
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)