diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/__future__.py | 15 | ||||
-rw-r--r-- | Lib/test/test___future__.py | 13 |
2 files changed, 17 insertions, 11 deletions
diff --git a/Lib/__future__.py b/Lib/__future__.py index ef9fd36..5a64838 100644 --- a/Lib/__future__.py +++ b/Lib/__future__.py @@ -55,14 +55,7 @@ all_feature_names = [ __all__ = ["all_feature_names"] + all_feature_names - -# The CO_xxx symbols are defined here under the same names used by -# compile.h, so that an editor search will find them here. However, -# they're not exported in __all__, because they don't really belong to -# this module. -CO_NESTED = 0x0010 # nested_scopes -CO_GENERATOR_ALLOWED = 0x1000 # generators -CO_FUTURE_DIVISION = 0x2000 # division +import new as _new # for CO_xxx symbols class _Feature: def __init__(self, optionalRelease, mandatoryRelease, compiler_flag): @@ -93,12 +86,12 @@ class _Feature: nested_scopes = _Feature((2, 1, 0, "beta", 1), (2, 2, 0, "alpha", 0), - CO_NESTED) + _new.CO_NESTED) generators = _Feature((2, 2, 0, "alpha", 1), (2, 3, 0, "final", 0), - CO_GENERATOR_ALLOWED) + _new.CO_GENERATOR_ALLOWED) division = _Feature((2, 2, 0, "alpha", 2), (3, 0, 0, "alpha", 0), - CO_FUTURE_DIVISION) + _new.CO_FUTURE_DIVISION) 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: |