2 from test_support
import verbose
, verify
3 from types
import TupleType
, StringType
, IntType
6 GOOD_SERIALS
= ("alpha", "beta", "candidate", "final")
8 features
= [x
for x
in dir(__future__
) if x
[:1] != "_"]
9 for feature
in features
:
10 value
= getattr(__future__
, feature
)
12 print "Checking __future__ ", feature
, "value", value
14 optional
= value
.getOptionalRelease()
15 mandatory
= value
.getMandatoryRelease()
17 verify(type(optional
) is TupleType
, "optional isn't tuple")
18 verify(len(optional
) == 5, "optional isn't 5-tuple")
19 major
, minor
, micro
, level
, serial
= optional
20 verify(type(major
) is IntType
, "optional major isn't int")
21 verify(type(minor
) is IntType
, "optional minor isn't int")
22 verify(type(micro
) is IntType
, "optional micro isn't int")
23 verify(type(level
) is StringType
, "optional level isn't string")
24 verify(level
in GOOD_SERIALS
,
25 "optional level string has unknown value")
26 verify(type(serial
) is IntType
, "optional serial isn't int")
28 verify(type(mandatory
) is TupleType
or
29 mandatory
is None, "mandatory isn't tuple or None")
30 if mandatory
is not None:
31 verify(len(mandatory
) == 5, "mandatory isn't 5-tuple")
32 major
, minor
, micro
, level
, serial
= mandatory
33 verify(type(major
) is IntType
, "mandatory major isn't int")
34 verify(type(minor
) is IntType
, "mandatory minor isn't int")
35 verify(type(micro
) is IntType
, "mandatory micro isn't int")
36 verify(type(level
) is StringType
, "mandatory level isn't string")
37 verify(level
in GOOD_SERIALS
,
38 "mandatory serial string has unknown value")
39 verify(type(serial
) is IntType
, "mandatory serial isn't int")
40 verify(optional
< mandatory
,
41 "optional not less than mandatory, and mandatory not None")