blob: 3ae1cf1f21c28f83df5de4cac5703eea2e5364da [file] [log] [blame]
Tim Petersffc215a2001-02-26 21:14:49 +00001#! /usr/bin/env python
2from test_support import verbose, verify
3from types import TupleType, StringType, IntType
4import __future__
5
6GOOD_SERIALS = ("alpha", "beta", "candidate", "final")
7
8features = [x for x in dir(__future__) if x[:1] != "_"]
9for feature in features:
10 value = getattr(__future__, feature)
11 if verbose:
12 print "Checking __future__ ", feature, "value", value
13 verify(type(value) is TupleType, "feature value isn't tuple")
14 verify(len(value) == 2, "feature value isn't 2-tuple")
15
16 optional, mandatory = value
17
18 verify(type(optional) is TupleType, "optional isn't tuple")
19 verify(len(optional) == 5, "optional isn't 5-tuple")
20 major, minor, micro, level, serial = optional
21 verify(type(major) is IntType, "optional major isn't int")
22 verify(type(minor) is IntType, "optional minor isn't int")
23 verify(type(micro) is IntType, "optional micro isn't int")
24 verify(type(level) is StringType, "optional level isn't string")
25 verify(level in GOOD_SERIALS,
26 "optional level string has unknown value")
27 verify(type(serial) is IntType, "optional serial isn't int")
28
29 verify(type(mandatory) is TupleType or
30 mandatory is None, "mandatory isn't tuple or None")
31 if mandatory is not None:
32 verify(len(mandatory) == 5, "mandatory isn't 5-tuple")
33 major, minor, micro, level, serial = mandatory
34 verify(type(major) is IntType, "mandatory major isn't int")
35 verify(type(minor) is IntType, "mandatory minor isn't int")
36 verify(type(micro) is IntType, "mandatory micro isn't int")
37 verify(type(level) is StringType, "mandatory level isn't string")
38 verify(level in GOOD_SERIALS,
39 "mandatory serial string has unknown value")
40 verify(type(serial) is IntType, "mandatory serial isn't int")
41 verify(optional < mandatory,
42 "optional not less than mandatory, and mandatory not None")