summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-01-18 20:29:55 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-01-18 20:29:55 (GMT)
commit58eb11cf62dd04ccc2c364b62fd51b4265e2e203 (patch)
tree6b4639f640391b3d40332ee045dba325c63a920d /Lib/test
parent5303a968080bdb2690eaab89495ae51939fa6397 (diff)
downloadcpython-58eb11cf62dd04ccc2c364b62fd51b4265e2e203.zip
cpython-58eb11cf62dd04ccc2c364b62fd51b4265e2e203.tar.gz
cpython-58eb11cf62dd04ccc2c364b62fd51b4265e2e203.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/pystone.py1
-rw-r--r--Lib/test/test_applesingle.py2
-rw-r--r--Lib/test/test_codeccallbacks.py2
-rw-r--r--Lib/test/test_codecencodings_cn.py5
-rw-r--r--Lib/test/test_codecencodings_jp.py1
-rw-r--r--Lib/test/test_codecencodings_kr.py1
-rw-r--r--Lib/test/test_codecencodings_tw.py1
-rw-r--r--Lib/test/test_codecmaps_cn.py1
-rw-r--r--Lib/test/test_codecmaps_jp.py1
-rw-r--r--Lib/test/test_codecmaps_kr.py1
-rw-r--r--Lib/test/test_codecmaps_tw.py1
-rw-r--r--Lib/test/test_curses.py4
-rw-r--r--Lib/test/test_descr.py2
-rw-r--r--Lib/test/test_difflib.py1
-rw-r--r--Lib/test/test_marshal.py8
-rw-r--r--Lib/test/test_md5.py4
-rw-r--r--Lib/test/test_multibytecodec.py1
-rw-r--r--Lib/test/test_multibytecodec_support.py1
-rw-r--r--Lib/test/test_os.py6
-rw-r--r--Lib/test/test_re.py2
-rw-r--r--Lib/test/test_set.py2
-rw-r--r--Lib/test/test_sort.py2
-rw-r--r--Lib/test/test_support.py2
-rw-r--r--Lib/test/test_unicode_file.py6
-rw-r--r--Lib/test/test_urllib2.py40
25 files changed, 43 insertions, 55 deletions
diff --git a/Lib/test/pystone.py b/Lib/test/pystone.py
index 168c399..0a25981 100755
--- a/Lib/test/pystone.py
+++ b/Lib/test/pystone.py
@@ -264,4 +264,3 @@ if __name__ == '__main__':
else:
loops = LOOPS
main(loops)
-
diff --git a/Lib/test/test_applesingle.py b/Lib/test/test_applesingle.py
index eeb01c5..2a2d60a 100644
--- a/Lib/test/test_applesingle.py
+++ b/Lib/test/test_applesingle.py
@@ -55,7 +55,7 @@ class TestApplesingle(unittest.TestCase):
applesingle.decode(test_support.TESTFN, TESTFN2)
self.compareData(False, dataforkdata)
self.compareData(True, resourceforkdata)
-
+
def test_applesingle_resonly(self):
try:
os.unlink(TESTFN2)
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index 289e838..ac561cc 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -697,7 +697,7 @@ class CodecCallbackTest(unittest.TestCase):
ord(">"): u"&gt;",
ord('"'): u"&quot;",
}
-
+
for n in (1, 10, 100, 1000):
text = u'abc<def>ghi'*n
text.translate(charmap)
diff --git a/Lib/test/test_codecencodings_cn.py b/Lib/test/test_codecencodings_cn.py
index 3960c9c..269e00a 100644
--- a/Lib/test/test_codecencodings_cn.py
+++ b/Lib/test/test_codecencodings_cn.py
@@ -27,8 +27,8 @@ class Test_GBK(test_multibytecodec_support.TestBase, unittest.TestCase):
tstring = test_multibytecodec_support.load_teststring('gbk')
codectests = (
# invalid bytes
- ("abc\x80\x80\xc1\xc4", "strict", None),
- ("abc\xc8", "strict", None),
+ ("abc\x80\x80\xc1\xc4", "strict", None),
+ ("abc\xc8", "strict", None),
("abc\x80\x80\xc1\xc4", "replace", u"abc\ufffd\u804a"),
("abc\x80\x80\xc1\xc4\xc8", "replace", u"abc\ufffd\u804a\ufffd"),
("abc\x80\x80\xc1\xc4", "ignore", u"abc\u804a"),
@@ -58,4 +58,3 @@ def test_main():
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecencodings_jp.py b/Lib/test/test_codecencodings_jp.py
index 264b6b9..f574511 100644
--- a/Lib/test/test_codecencodings_jp.py
+++ b/Lib/test/test_codecencodings_jp.py
@@ -131,4 +131,3 @@ def test_main():
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecencodings_kr.py b/Lib/test/test_codecencodings_kr.py
index 17615ba..449237d 100644
--- a/Lib/test/test_codecencodings_kr.py
+++ b/Lib/test/test_codecencodings_kr.py
@@ -54,4 +54,3 @@ def test_main():
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecencodings_tw.py b/Lib/test/test_codecencodings_tw.py
index 3e2fa8b..897f060 100644
--- a/Lib/test/test_codecencodings_tw.py
+++ b/Lib/test/test_codecencodings_tw.py
@@ -28,4 +28,3 @@ def test_main():
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecmaps_cn.py b/Lib/test/test_codecmaps_cn.py
index 919c81b..337ac91 100644
--- a/Lib/test/test_codecmaps_cn.py
+++ b/Lib/test/test_codecmaps_cn.py
@@ -31,4 +31,3 @@ def test_main():
test_multibytecodec_support.register_skip_expected(TestGB2312Map, TestGBKMap)
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecmaps_jp.py b/Lib/test/test_codecmaps_jp.py
index ef49178..9519da2 100644
--- a/Lib/test/test_codecmaps_jp.py
+++ b/Lib/test/test_codecmaps_jp.py
@@ -87,4 +87,3 @@ test_multibytecodec_support.register_skip_expected(TestCP932Map,
TestSJISX0213Map)
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecmaps_kr.py b/Lib/test/test_codecmaps_kr.py
index 910396e..9a71939 100644
--- a/Lib/test/test_codecmaps_kr.py
+++ b/Lib/test/test_codecmaps_kr.py
@@ -48,4 +48,3 @@ test_multibytecodec_support.register_skip_expected(TestCP949Map,
TestEUCKRMap, TestJOHABMap)
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_codecmaps_tw.py b/Lib/test/test_codecmaps_tw.py
index 9b28fef..2f41660 100644
--- a/Lib/test/test_codecmaps_tw.py
+++ b/Lib/test/test_codecmaps_tw.py
@@ -36,4 +36,3 @@ def test_main():
test_multibytecodec_support.register_skip_expected(TestBIG5Map, TestCP950Map)
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 10ebe09..2065ef2 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -204,7 +204,7 @@ def unit_tests():
]:
if ascii.unctrl(ch) != expected:
print 'curses.unctrl fails on character', repr(ch)
-
+
def main(stdscr):
@@ -215,7 +215,7 @@ def main(stdscr):
finally:
curses.resetty()
-
+
if __name__ == '__main__':
curses.wrapper(main)
unit_tests()
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index e001562..d0500e6 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3966,7 +3966,7 @@ def vicious_descriptor_nonsense():
# this makes a crash more likely:
import gc; gc.collect()
vereq(hasattr(c, 'attr'), False)
-
+
def test_main():
weakref_segfault() # Must be first, somehow
diff --git a/Lib/test/test_difflib.py b/Lib/test/test_difflib.py
index 3879967..1703754 100644
--- a/Lib/test/test_difflib.py
+++ b/Lib/test/test_difflib.py
@@ -15,4 +15,3 @@ class TestSFbugs(unittest.TestCase):
Doctests = doctest.DocTestSuite(difflib)
test_support.run_unittest(TestSFbugs, Doctests)
-
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index ad45c29..f971d11 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -55,7 +55,7 @@ class IntTestCase(unittest.TestCase):
new = marshal.load(file(test_support.TESTFN, "rb"))
self.assertEqual(b, new)
self.assertEqual(type(b), type(new))
-
+
class FloatTestCase(unittest.TestCase):
def test_floats(self):
# Test a few floats
@@ -122,7 +122,7 @@ class StringTestCase(unittest.TestCase):
marshal.load(file(test_support.TESTFN, "rb"))
self.assertEqual(s, new)
os.unlink(test_support.TESTFN)
-
+
class ExceptionTestCase(unittest.TestCase):
def test_exceptions(self):
new = marshal.loads(marshal.dumps(StopIteration))
@@ -151,7 +151,7 @@ class ContainerTestCase(unittest.TestCase):
marshal.load(file(test_support.TESTFN, "rb"))
self.assertEqual(self.d, new)
os.unlink(test_support.TESTFN)
-
+
def test_list(self):
lst = self.d.items()
new = marshal.loads(marshal.dumps(lst))
@@ -169,7 +169,7 @@ class ContainerTestCase(unittest.TestCase):
marshal.load(file(test_support.TESTFN, "rb"))
self.assertEqual(t, new)
os.unlink(test_support.TESTFN)
-
+
class BugsTestCase(unittest.TestCase):
def test_bug_5888452(self):
# Simple-minded check for SF 588452: Debug build crashes
diff --git a/Lib/test/test_md5.py b/Lib/test/test_md5.py
index bd0fb2e..1f08568 100644
--- a/Lib/test/test_md5.py
+++ b/Lib/test/test_md5.py
@@ -26,9 +26,9 @@ class MD5_Test(unittest.TestCase):
eq('abc', '900150983cd24fb0d6963f7d28e17f72')
eq('message digest', 'f96b697d7cb7938d525a2f31aaf161d0')
eq('abcdefghijklmnopqrstuvwxyz', 'c3fcd3d76192e4007dfb496cca67e13b')
- eq('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
+ eq('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
'd174ab98d277d9f5a5611c2c9f419d9f')
- eq('12345678901234567890123456789012345678901234567890123456789012345678901234567890',
+ eq('12345678901234567890123456789012345678901234567890123456789012345678901234567890',
'57edf4a22be3c955ac49da2e2107b67a')
def test_hexdigest(self):
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index f686b70..c77898b 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -76,4 +76,3 @@ def test_main():
if __name__ == "__main__":
test_main()
-
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 6185243..77033cd 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -230,4 +230,3 @@ def register_skip_expected(*cases):
break
else:
sys.modules[case.__module__].skip_expected = False
-
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 221571a..db8d99e 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -319,10 +319,10 @@ class MakedirTests (unittest.TestCase):
path = os.path.join(base, 'dir1', os.curdir, 'dir2', 'dir3', 'dir4',
'dir5', 'dir6')
os.makedirs(path)
-
-
-
+
+
+
def tearDown(self):
path = os.path.join(test_support.TESTFN, 'dir1', 'dir2', 'dir3',
'dir4', 'dir5', 'dir6')
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index d2e2753..6ceab6d 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -405,7 +405,7 @@ class ReTests(unittest.TestCase):
20003)
self.assertEqual(re.match('.*?cd', 20000*'abc'+'de').end(0), 60001)
# non-simple '*?' still used to hit the recursion limit, before the
- # non-recursive scheme was implemented.
+ # non-recursive scheme was implemented.
self.assertEqual(re.search('(a|b)*?c', 10000*'ab'+'cd').end(0), 20001)
def test_bug_612074(self):
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 2104ee9..3b108a1 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -179,7 +179,7 @@ class TestJointOps(unittest.TestCase):
def __init__(self, value):
self.value = value
def __hash__(self):
- return self.value
+ return self.value
def __deepcopy__(self, memo=None):
return Tracer(self.value + 1)
t = Tracer(10)
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index dedc41c..5d670a8 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -270,5 +270,3 @@ def test_main(verbose=None):
if __name__ == "__main__":
test_main(verbose=True)
-
-
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 6a0b0d8..485e9e0 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -141,7 +141,7 @@ else:
# which have special Unicode support in posixmodule.
if (not hasattr(sys, "getwindowsversion") or
sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME
- TESTFN_UNICODE_UNENCODEABLE = None
+ TESTFN_UNICODE_UNENCODEABLE = None
else:
# Japanese characters (I think - from bug 846133)
TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b"
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index fbca88b..46a99f2 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -20,7 +20,7 @@ def remove_if_exists(filename):
class TestUnicodeFiles(unittest.TestCase):
# The 'do_' functions are the actual tests. They generally assume the
# file already exists etc.
-
+
# Do all the tests we can given only a single filename. The file should
# exist.
def _do_single(self, filename):
@@ -39,7 +39,7 @@ class TestUnicodeFiles(unittest.TestCase):
# basename should appear in listdir.
path, base = os.path.split(os.path.abspath(filename))
self.failUnless(base in os.listdir(path))
-
+
# Do as many "equivalancy' tests as we can - ie, check that although we
# have different types for the filename, they refer to the same file.
def _do_equivilent(self, filename1, filename2):
@@ -124,7 +124,7 @@ class TestUnicodeFiles(unittest.TestCase):
self._do_single(filename)
finally:
os.unlink(filename)
-
+
def _test_equivalent(self, filename1, filename2):
remove_if_exists(filename1)
self.failUnless(not os.path.exists(filename2))
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 6438b4e..87de229 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -269,6 +269,14 @@ class OpenerDirectorTests(unittest.TestCase):
isinstance(args[1], MockResponse))
+def sanepathname2url(path):
+ import urllib
+ urlpath = urllib.pathname2url(path)
+ if os.name == "nt" and urlpath.startswith("///"):
+ urlpath = urlpath[2:]
+ # XXX don't ask me about the mac...
+ return urlpath
+
class HandlerTests(unittest.TestCase):
def test_ftp(self):
@@ -323,19 +331,17 @@ class HandlerTests(unittest.TestCase):
h = urllib2.FileHandler()
o = h.parent = MockOpener()
- #from test_support import TESTFN
- TESTFN = "test.txt"
+ TESTFN = test_support.TESTFN
+ urlpath = sanepathname2url(os.path.abspath(TESTFN))
towrite = "hello, world\n"
for url in [
- "file://localhost%s/%s" % (os.getcwd(), TESTFN),
- "file://%s/%s" % (os.getcwd(), TESTFN),
- "file://%s%s/%s" % (socket.gethostbyname('localhost'),
- os.getcwd(), TESTFN),
- "file://%s%s/%s" % (socket.gethostbyname(socket.gethostname()),
- os.getcwd(), TESTFN),
- # XXX Windows / Mac format(s), ... ?
+ "file://localhost%s" % urlpath,
+ "file://%s" % urlpath,
+ "file://%s%s" % (socket.gethostbyname('localhost'), urlpath),
+ "file://%s%s" % (socket.gethostbyname(socket.gethostname()),
+ urlpath),
]:
- f = open(TESTFN, "w")
+ f = open(TESTFN, "wb")
try:
try:
f.write(towrite)
@@ -345,25 +351,21 @@ class HandlerTests(unittest.TestCase):
r = h.file_open(Request(url))
try:
data = r.read()
- read_time = time.time()
headers = r.info()
newurl = r.geturl()
finally:
r.close()
+ stats = os.stat(TESTFN)
+ modified = rfc822.formatdate(stats.st_mtime)
finally:
os.remove(TESTFN)
self.assertEqual(data, towrite)
self.assertEqual(headers["Content-type"], "text/plain")
self.assertEqual(headers["Content-length"], "13")
- # Fudge Last-modified string comparison by one second to
- # prevent spurious failure on crossing a second boundary while
- # executing this test.
- unfudged = rfc822.formatdate(read_time)
- fudged = rfc822.formatdate(read_time-1)
- self.assert_(headers["Last-modified"] in [unfudged, fudged])
+ self.assertEqual(headers["Last-modified"], modified)
for url in [
- "file://localhost:80%s/%s" % (os.getcwd(), TESTFN),
+ "file://localhost:80%s" % urlpath,
# XXXX bug: these fail with socket.gaierror, should be URLError
## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'),
## os.getcwd(), TESTFN),
@@ -371,7 +373,7 @@ class HandlerTests(unittest.TestCase):
## (os.getcwd(), TESTFN),
]:
try:
- f = open(TESTFN, "w")
+ f = open(TESTFN, "wb")
try:
f.write(towrite)
finally: