Back to index

python3.2  3.2.2
Public Member Functions
test.test___future__.FutureTest Class Reference

List of all members.

Public Member Functions

def test_names
def test_attributes

Detailed Description

Definition at line 10 of file test___future__.py.


Member Function Documentation

Definition at line 26 of file test___future__.py.

00026 
00027     def test_attributes(self):
00028         for feature in features:
00029             value = getattr(__future__, feature)
00030 
00031             optional = value.getOptionalRelease()
00032             mandatory = value.getMandatoryRelease()
00033 
00034             a = self.assertTrue
00035             e = self.assertEqual
00036             def check(t, name):
00037                 a(isinstance(t, tuple), "%s isn't tuple" % name)
00038                 e(len(t), 5, "%s isn't 5-tuple" % name)
00039                 (major, minor, micro, level, serial) = t
00040                 a(isinstance(major, int), "%s major isn't int"  % name)
00041                 a(isinstance(minor, int), "%s minor isn't int" % name)
00042                 a(isinstance(micro, int), "%s micro isn't int" % name)
00043                 a(isinstance(level, str),
00044                     "%s level isn't string" % name)
00045                 a(level in GOOD_SERIALS,
00046                        "%s level string has unknown value" % name)
00047                 a(isinstance(serial, int), "%s serial isn't int" % name)
00048 
00049             check(optional, "optional")
00050             if mandatory is not None:
00051                 check(mandatory, "mandatory")
00052                 a(optional < mandatory,
00053                        "optional not less than mandatory, and mandatory not None")
00054 
00055             a(hasattr(value, "compiler_flag"),
00056                    "feature is missing a .compiler_flag attr")
00057             # Make sure the compile accepts the flag.
00058             compile("", "<test>", "exec", value.compiler_flag)
00059             a(isinstance(getattr(value, "compiler_flag"), int),
00060                    ".compiler_flag isn't int")
00061 

Here is the call graph for this function:

Definition at line 12 of file test___future__.py.

00012 
00013     def test_names(self):
00014         # Verify that all_feature_names appears correct.
00015         given_feature_names = features[:]
00016         for name in dir(__future__):
00017             obj = getattr(__future__, name, None)
00018             if obj is not None and isinstance(obj, __future__._Feature):
00019                 self.assertTrue(
00020                     name in given_feature_names,
00021                     "%r should have been in all_feature_names" % name
00022                 )
00023                 given_feature_names.remove(name)
00024         self.assertEqual(len(given_feature_names), 0,
00025                "all_feature_names has too much: %r" % given_feature_names)

Here is the call graph for this function:


The documentation for this class was generated from the following file: