summaryrefslogtreecommitdiff
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-12-06 23:30:07 +0000
committerBarry Warsaw <barry@python.org>1996-12-06 23:30:07 +0000
commit4856b426b380d4d46cccc2f5b8ab2212956a96c2 (patch)
treec61ec93eefa6d76ce4403e6423dd988fdc74686b /Lib/test/test_time.py
parent94ca1db04a19a9472637143f8db65f6e22992240 (diff)
downloadcpython-4856b426b380d4d46cccc2f5b8ab2212956a96c2.tar.gz
test of time module. not terribly fancy, but it does touch every
function and variable in the module, verifies a few return values and even tests a couple of known error conditions.
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
new file mode 100644
index 0000000000..bfc768a22a
--- /dev/null
+++ b/Lib/test/test_time.py
@@ -0,0 +1,36 @@
+import time
+
+time.altzone
+time.clock()
+t = time.time()
+time.asctime(time.gmtime(t))
+if time.ctime(t) <> time.asctime(time.localtime(t)):
+ print 'time.ctime(t) <> time.asctime(time.localtime(t))'
+
+time.daylight
+if int(time.mktime(time.localtime(t))) <> int(t):
+ print 'time.mktime(time.localtime(t)) <> t'
+
+time.sleep(1.2)
+tt = time.gmtime(t)
+for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'E', 'H', 'I',
+ 'j', 'm', 'M', 'n', 'N', 'o', 'p', 'S', 't',
+ 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
+ format = '%' + directive
+ time.strftime(format, tt)
+
+time.timezone
+time.tzname
+
+# expected errors
+try:
+ time.asctime(0)
+except TypeError:
+ pass
+
+try:
+ time.mktime((999999, 999999, 999999, 999999,
+ 999999, 999999, 999999, 999999,
+ 999999))
+except OverflowError:
+ pass