Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_time.py @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | 7f6ddf555c12 |
| children | e28868cf9825 6768b2350c57 |
| rev | line source |
|---|---|
|
24364
aa0d2d51fbde
Get rid of relative imports in all unittests. Now anything that
Barry Warsaw <barry@python.org>
parents:
24322
diff
changeset
|
1 from test import test_support |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
2 import time |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
3 import unittest |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
4 |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
5 |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
6 class TimeTestCase(unittest.TestCase): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
7 |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
8 def setUp(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
9 self.t = time.time() |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
10 |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
11 def test_data_attributes(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
12 time.altzone |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
13 time.daylight |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
14 time.timezone |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
15 time.tzname |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
16 |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
17 def test_clock(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
18 time.clock() |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
19 |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
20 def test_conversions(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
21 self.assert_(time.ctime(self.t) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
22 == time.asctime(time.localtime(self.t))) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
23 self.assert_(long(time.mktime(time.localtime(self.t))) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
24 == long(self.t)) |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
25 |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
26 def test_sleep(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
27 time.sleep(1.2) |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
28 |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
29 def test_strftime(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
30 tt = time.gmtime(self.t) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
31 for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
32 'j', 'm', 'M', 'p', 'S', |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
33 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
34 format = ' %' + directive |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
35 try: |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
36 time.strftime(format, tt) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
37 except ValueError: |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
38 self.fail('conversion specifier: %r failed.' % format) |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
39 |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
40 def test_strftime_bounds_checking(self): |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
41 # Make sure that strftime() checks the bounds of the various parts |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
42 #of the time tuple (0 is valid for *all* values). |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
43 |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
44 # Check year [1900, max(int)] |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
45 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
46 (1899, 1, 1, 0, 0, 0, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
47 if time.accept2dyear: |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
48 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
49 (-1, 1, 1, 0, 0, 0, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
50 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
51 (100, 1, 1, 0, 0, 0, 0, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
52 # Check month [1, 12] + zero support |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
53 self.assertRaises(ValueError, time.strftime, '', |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
54 (1900, -1, 1, 0, 0, 0, 0, 1, -1)) |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
55 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
56 (1900, 13, 1, 0, 0, 0, 0, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
57 # Check day of month [1, 31] + zero support |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
58 self.assertRaises(ValueError, time.strftime, '', |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
59 (1900, 1, -1, 0, 0, 0, 0, 1, -1)) |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
60 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
61 (1900, 1, 32, 0, 0, 0, 0, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
62 # Check hour [0, 23] |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
63 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
64 (1900, 1, 1, -1, 0, 0, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
65 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
66 (1900, 1, 1, 24, 0, 0, 0, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
67 # Check minute [0, 59] |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
68 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
69 (1900, 1, 1, 0, -1, 0, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
70 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
71 (1900, 1, 1, 0, 60, 0, 0, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
72 # Check second [0, 61] |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
73 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
74 (1900, 1, 1, 0, 0, -1, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
75 # C99 only requires allowing for one leap second, but Python's docs say |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
76 # allow two leap seconds (0..61) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
77 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
78 (1900, 1, 1, 0, 0, 62, 0, 1, -1)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
79 # No check for upper-bound day of week; |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
80 # value forced into range by a ``% 7`` calculation. |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
81 # Start check at -2 since gettmarg() increments value before taking |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
82 # modulo. |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
83 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
84 (1900, 1, 1, 0, 0, 0, -2, 1, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
85 # Check day of the year [1, 366] + zero support |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
86 self.assertRaises(ValueError, time.strftime, '', |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
87 (1900, 1, 1, 0, 0, 0, 0, -1, -1)) |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
88 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
89 (1900, 1, 1, 0, 0, 0, 0, 367, -1)) |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
90 # Check daylight savings flag [-1, 1] |
|
31608
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
91 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
92 (1900, 1, 1, 0, 0, 0, 0, 1, -2)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
93 self.assertRaises(ValueError, time.strftime, '', |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
94 (1900, 1, 1, 0, 0, 0, 0, 1, 2)) |
|
ae8dbf500172
Have strftime() check its time tuple argument to make sure the tuple's values
Brett Cannon <bcannon@gmail.com>
parents:
28774
diff
changeset
|
95 |
|
39114
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
96 def test_default_values_for_zero(self): |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
97 # Make sure that using all zeros uses the proper default values. |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
98 # No test for daylight savings since strftime() does not change output |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
99 # based on its value. |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
100 expected = "2000 01 01 00 00 00 1 001" |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
101 result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9) |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
102 self.assertEquals(expected, result) |
|
979e390e2bb4
Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds
Brett Cannon <bcannon@gmail.com>
parents:
38836
diff
changeset
|
103 |
|
24322
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
104 def test_strptime(self): |
|
39878
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
105 # Should be able to go round-trip from strftime to strptime without |
|
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
106 # throwing an exception. |
|
24322
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
107 tt = time.gmtime(self.t) |
|
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
108 for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', |
|
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
109 'j', 'm', 'M', 'p', 'S', |
|
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
110 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): |
|
39878
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
111 format = '%' + directive |
|
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
112 strf_output = time.strftime(format, tt) |
|
24322
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
113 try: |
|
39878
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
114 time.strptime(strf_output, format) |
|
24322
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
115 except ValueError: |
|
39878
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
116 self.fail("conversion specifier %r failed with '%s' input." % |
|
7f6ddf555c12
Make output on test_strptime() be more verbose in face of failure. This is in
Brett Cannon <bcannon@gmail.com>
parents:
39114
diff
changeset
|
117 (format, strf_output)) |
|
24322
afe479a6235e
Pure Python strptime implementation by Brett Cannon. See SF patch 474274.
Guido van Rossum <guido@python.org>
parents:
23085
diff
changeset
|
118 |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
119 def test_asctime(self): |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
120 time.asctime(time.gmtime(self.t)) |
|
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
121 self.assertRaises(TypeError, time.asctime, 0) |
|
4612
4de05cbf5ad1
test of time module. not terribly fancy, but it does touch every
Barry Warsaw <barry@python.org>
parents:
diff
changeset
|
122 |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
123 def test_tzset(self): |
|
28300
9602c664ed7a
If time.tzset doesn't exist, don't test it.
Guido van Rossum <guido@python.org>
parents:
28299
diff
changeset
|
124 if not hasattr(time, "tzset"): |
|
9602c664ed7a
If time.tzset doesn't exist, don't test it.
Guido van Rossum <guido@python.org>
parents:
28299
diff
changeset
|
125 return # Can't test this; don't want the test suite to fail |
|
9602c664ed7a
If time.tzset doesn't exist, don't test it.
Guido van Rossum <guido@python.org>
parents:
28299
diff
changeset
|
126 |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
127 from os import environ |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
128 |
|
28774
c9bee11eaa8b
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
28579
diff
changeset
|
129 # Epoch time of midnight Dec 25th 2002. Never DST in northern |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
130 # hemisphere. |
|
28774
c9bee11eaa8b
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
28579
diff
changeset
|
131 xmas2002 = 1040774400.0 |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
132 |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
133 # These formats are correct for 2002, and possibly future years |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
134 # This format is the 'standard' as documented at: |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
135 # http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
136 # They are also documented in the tzset(3) man page on most Unix |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
137 # systems. |
|
28774
c9bee11eaa8b
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
28579
diff
changeset
|
138 eastern = 'EST+05EDT,M4.1.0,M10.5.0' |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
139 victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0' |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
140 utc='UTC+0' |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
141 |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
142 org_TZ = environ.get('TZ',None) |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
143 try: |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
144 # Make sure we can switch to UTC time and results are correct |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
145 # Note that unknown timezones default to UTC. |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
146 # Note that altzone is undefined in UTC, as there is no DST |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
147 environ['TZ'] = eastern |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
148 time.tzset() |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
149 environ['TZ'] = utc |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
150 time.tzset() |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
151 self.failUnlessEqual( |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
152 time.gmtime(xmas2002), time.localtime(xmas2002) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
153 ) |
|
28774
c9bee11eaa8b
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
28579
diff
changeset
|
154 self.failUnlessEqual(time.daylight, 0) |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
155 self.failUnlessEqual(time.timezone, 0) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
156 self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
157 |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
158 # Make sure we can switch to US/Eastern |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
159 environ['TZ'] = eastern |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
160 time.tzset() |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
161 self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
162 self.failUnlessEqual(time.tzname, ('EST', 'EDT')) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
163 self.failUnlessEqual(len(time.tzname), 2) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
164 self.failUnlessEqual(time.daylight, 1) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
165 self.failUnlessEqual(time.timezone, 18000) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
166 self.failUnlessEqual(time.altzone, 14400) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
167 self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 0) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
168 self.failUnlessEqual(len(time.tzname), 2) |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
169 |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
170 # Now go to the southern hemisphere. |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
171 environ['TZ'] = victoria |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
172 time.tzset() |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
173 self.failIfEqual(time.gmtime(xmas2002), time.localtime(xmas2002)) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
174 self.failUnless(time.tzname[0] == 'AEST', str(time.tzname[0])) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
175 self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1])) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
176 self.failUnlessEqual(len(time.tzname), 2) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
177 self.failUnlessEqual(time.daylight, 1) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
178 self.failUnlessEqual(time.timezone, -36000) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
179 self.failUnlessEqual(time.altzone, -39600) |
|
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
180 self.failUnlessEqual(time.localtime(xmas2002).tm_isdst, 1) |
|
28299
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
181 |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
182 finally: |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
183 # Repair TZ environment variable in case any other tests |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
184 # rely on it. |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
185 if org_TZ is not None: |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
186 environ['TZ'] = org_TZ |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
187 elif environ.has_key('TZ'): |
|
14316df1c298
- New function time.tzset() provides access to the C library tzet()
Guido van Rossum <guido@python.org>
parents:
24364
diff
changeset
|
188 del environ['TZ'] |
|
28579
981032e64736
SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Neal Norwitz <nnorwitz@gmail.com>
parents:
28300
diff
changeset
|
189 time.tzset() |
|
28774
c9bee11eaa8b
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
28579
diff
changeset
|
190 |
|
32388
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
191 def test_insane_timestamps(self): |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
192 # It's possible that some platform maps time_t to double, |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
193 # and that this test will fail there. This test should |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
194 # exempt such platforms (provided they return reasonable |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
195 # results!). |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
196 for func in time.ctime, time.gmtime, time.localtime: |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
197 for unreasonable in -1e200, 1e200: |
|
5cf507b64f31
Bug 975996: Add _PyTime_DoubleToTimet to C API
Tim Peters <tim.peters@gmail.com>
parents:
31608
diff
changeset
|
198 self.assertRaises(ValueError, func, unreasonable) |
|
17912
421b1d660495
Convert time module tests to PyUnit.
Fred Drake <fdrake@acm.org>
parents:
15540
diff
changeset
|
199 |
|
32939
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
200 def test_ctime_without_arg(self): |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
201 # Not sure how to check the values, since the clock could tick |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
202 # at any time. Make sure these are at least accepted and |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
203 # don't raise errors. |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
204 time.ctime() |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
205 time.ctime(None) |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
206 |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
207 def test_gmtime_without_arg(self): |
|
38836
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
208 gt0 = time.gmtime() |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
209 gt1 = time.gmtime(None) |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
210 t0 = time.mktime(gt0) |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
211 t1 = time.mktime(gt1) |
|
32939
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
212 self.assert_(0 <= (t1-t0) < 0.2) |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
213 |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
214 def test_localtime_without_arg(self): |
|
38836
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
215 lt0 = time.localtime() |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
216 lt1 = time.localtime(None) |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
217 t0 = time.mktime(lt0) |
|
77b01c933308
Try to narrow window of failure on slow/busy boxes (ppc64 buildbot)
Neal Norwitz <nnorwitz@gmail.com>
parents:
32939
diff
changeset
|
218 t1 = time.mktime(lt1) |
|
32939
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
219 self.assert_(0 <= (t1-t0) < 0.2) |
|
582eb51b8492
allow ctime(), gmtime(), and localtime() to take None as equivalent to an omitted arg
Fred Drake <fdrake@acm.org>
parents:
32388
diff
changeset
|
220 |
|
20013
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
221 def test_main(): |
|
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
222 test_support.run_unittest(TimeTestCase) |
|
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
223 |
|
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
224 |
|
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
225 if __name__ == "__main__": |
|
e3184e46303b
Change the PyUnit-based tests to use the test_main() approach. This
Fred Drake <fdrake@acm.org>
parents:
17912
diff
changeset
|
226 test_main() |
