mirror of
https://github.com/python/cpython.git
synced 2025-07-12 22:05:16 +00:00

imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
28 lines
592 B
Python
28 lines
592 B
Python
from test.test_support import vereq
|
|
|
|
import time
|
|
|
|
t = time.gmtime()
|
|
astuple = tuple(t)
|
|
vereq(len(t), len(astuple))
|
|
vereq(t, astuple)
|
|
|
|
# Check that slicing works the same way; at one point, slicing t[i:j] with
|
|
# 0 < i < j could produce NULLs in the result.
|
|
for i in range(-len(t), len(t)):
|
|
for j in range(-len(t), len(t)):
|
|
vereq(t[i:j], astuple[i:j])
|
|
|
|
# Devious code could crash structseqs' contructors
|
|
class C:
|
|
def __getitem__(self, i):
|
|
raise IndexError
|
|
def __len__(self):
|
|
return 9
|
|
|
|
try:
|
|
repr(time.struct_time(C()))
|
|
except:
|
|
pass
|
|
|
|
# XXX more needed
|