blob: 2760d722b4e724830570dc035afb74453979de3a [file] [log] [blame]
Barry Warsaw04f357c2002-07-23 19:04:11 +00001from test.test_support import vereq
Tim Petersc2fe6182001-10-30 23:20:46 +00002
3import time
4
5t = time.gmtime()
6astuple = tuple(t)
7vereq(len(t), len(astuple))
8vereq(t, astuple)
9
10# Check that slicing works the same way; at one point, slicing t[i:j] with
11# 0 < i < j could produce NULLs in the result.
12for i in range(-len(t), len(t)):
13 for j in range(-len(t), len(t)):
14 vereq(t[i:j], astuple[i:j])
15
Michael W. Hudson02b28ec2002-03-06 17:18:15 +000016# Devious code could crash structseqs' contructors
17class C:
18 def __getitem__(self, i):
19 raise IndexError
20 def __len__(self):
21 return 9
22
23try:
24 repr(time.struct_time(C()))
25except:
26 pass
27
Tim Peters7e0f81e2001-10-31 03:46:14 +000028# XXX more needed