mirror of https://github.com/python/cpython
Merged revisions 83212,83829,83833,83838-83839,83878,84019,84025,84028,84032,84036 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83212 | florent.xicluna | 2010-07-28 18:39:41 +0200 (mer., 28 juil. 2010) | 2 lines Syntax cleanup. ........ r83829 | florent.xicluna | 2010-08-08 18:16:07 +0200 (dim., 08 août 2010) | 2 lines Use unittest specific methods for some urllib test cases. And replace urllib2 with urllib.request in comments. ........ r83833 | florent.xicluna | 2010-08-08 18:25:27 +0200 (dim., 08 août 2010) | 2 lines Add test case for the HTTPResponse being an iterable. Follow-up of issue #4608. ........ r83838 | florent.xicluna | 2010-08-08 20:03:44 +0200 (dim., 08 août 2010) | 2 lines Typo. ........ r83839 | florent.xicluna | 2010-08-08 20:06:13 +0200 (dim., 08 août 2010) | 2 lines Issue #7564: Skip test_ioctl if another process is attached to /dev/tty. ........ r83878 | florent.xicluna | 2010-08-09 10:29:08 +0200 (lun., 09 août 2010) | 1 line Merge the 2to3 script from /sandbox/trunk/2to3/2to3, revision 72867 (latest). ........ r84019 | florent.xicluna | 2010-08-14 17:56:42 +0200 (sam., 14 août 2010) | 11 lines Merged manually from 2.7 branch to 3.x trunk. ------------------------------------------------------------------------ r79925 | nick.coghlan | 2010-04-10 16:24:36 +0200 (sam. 10 avril 2010) Try to turn some buildbots green by allowing test_multiprocessing to pass even if it hits the sys.exc_clear code in the threading module, and improve the test coverage by making the ctypes dependencies a bit more granular (two of the cited ctypes objects don't exist on my system) ------------------------------------------------------------------------ ........ r84025 | florent.xicluna | 2010-08-14 18:56:27 +0200 (sam., 14 août 2010) | 1 line List Misc/python-config.in in Misc/README. Fix few typos. ........ r84028 | florent.xicluna | 2010-08-14 19:02:49 +0200 (sam., 14 août 2010) | 1 line Fix order. ........ r84032 | florent.xicluna | 2010-08-14 19:15:31 +0200 (sam., 14 août 2010) | 1 line Convert to spaces. ........ r84036 | florent.xicluna | 2010-08-14 20:03:19 +0200 (sam., 14 août 2010) | 1 line Remove bad merge (from svnmerge r82301) ........
This commit is contained in:
parent
3554473309
commit
b4efb3d81e
|
@ -1163,10 +1163,6 @@ functions based on regular expressions.
|
||||||
You can use :meth:`str.maketrans` to create a translation map from
|
You can use :meth:`str.maketrans` to create a translation map from
|
||||||
character-to-character mappings in different formats.
|
character-to-character mappings in different formats.
|
||||||
|
|
||||||
You can use the :func:`~string.maketrans` helper function in the :mod:`string`
|
|
||||||
module to create a translation table. For string objects, set the *table*
|
|
||||||
argument to ``None`` for translations that only delete characters:
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
An even more flexible approach is to create a custom character mapping
|
An even more flexible approach is to create a custom character mapping
|
||||||
|
|
|
@ -164,7 +164,7 @@ class SampleCallbacksTestCase(unittest.TestCase):
|
||||||
result = integrate(0.0, 1.0, CALLBACK(func), 10)
|
result = integrate(0.0, 1.0, CALLBACK(func), 10)
|
||||||
diff = abs(result - 1./3.)
|
diff = abs(result - 1./3.)
|
||||||
|
|
||||||
self.assertTrue(diff < 0.01, "%s not less than 0.01" % diff)
|
self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
|
|
|
@ -397,7 +397,7 @@ def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
|
||||||
yield 'true'
|
yield 'true'
|
||||||
elif o is False:
|
elif o is False:
|
||||||
yield 'false'
|
yield 'false'
|
||||||
elif isinstance(o, (int, int)):
|
elif isinstance(o, int):
|
||||||
yield str(o)
|
yield str(o)
|
||||||
elif isinstance(o, float):
|
elif isinstance(o, float):
|
||||||
yield _floatstr(o)
|
yield _floatstr(o)
|
||||||
|
|
|
@ -733,7 +733,7 @@ pylong = StackObject(
|
||||||
|
|
||||||
pyinteger_or_bool = StackObject(
|
pyinteger_or_bool = StackObject(
|
||||||
name='int_or_bool',
|
name='int_or_bool',
|
||||||
obtype=(int, int, bool),
|
obtype=(int, bool),
|
||||||
doc="A Python integer object (short or long), or "
|
doc="A Python integer object (short or long), or "
|
||||||
"a Python bool.")
|
"a Python bool.")
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ def isint(x):
|
||||||
|
|
||||||
def isnum(x):
|
def isnum(x):
|
||||||
"""Test whether an object is an instance of a built-in numeric type."""
|
"""Test whether an object is an instance of a built-in numeric type."""
|
||||||
for T in int, int, float, complex:
|
for T in int, float, complex:
|
||||||
if isinstance(x, T):
|
if isinstance(x, T):
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -7,9 +7,17 @@ get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tty = open("/dev/tty", "r")
|
tty = open("/dev/tty", "r")
|
||||||
tty.close()
|
|
||||||
except IOError:
|
except IOError:
|
||||||
raise unittest.SkipTest("Unable to open /dev/tty")
|
raise unittest.SkipTest("Unable to open /dev/tty")
|
||||||
|
else:
|
||||||
|
# Skip if another process is in foreground
|
||||||
|
r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
|
||||||
|
tty.close()
|
||||||
|
rpgrp = struct.unpack("i", r)[0]
|
||||||
|
if rpgrp not in (os.getpgrp(), os.getsid(0)):
|
||||||
|
raise unittest.SkipTest("Neither the process group nor the session "
|
||||||
|
"are attached to /dev/tty")
|
||||||
|
del tty, r, rpgrp
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pty
|
import pty
|
||||||
|
|
|
@ -14,7 +14,6 @@ import os
|
||||||
import gc
|
import gc
|
||||||
import signal
|
import signal
|
||||||
import array
|
import array
|
||||||
import copy
|
|
||||||
import socket
|
import socket
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
@ -68,11 +67,21 @@ WIN32 = (sys.platform == "win32")
|
||||||
#
|
#
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ctypes import Structure, Value, copy, c_int, c_double
|
from ctypes import Structure, c_int, c_double
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Structure = object
|
Structure = object
|
||||||
c_int = c_double = None
|
c_int = c_double = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ctypes import Value
|
||||||
|
except ImportError:
|
||||||
|
Value = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ctypes import copy as ctypes_copy
|
||||||
|
except ImportError:
|
||||||
|
ctypes_copy = None
|
||||||
|
|
||||||
#
|
#
|
||||||
# Creates a wrapper for a function which records the time it takes to finish
|
# Creates a wrapper for a function which records the time it takes to finish
|
||||||
#
|
#
|
||||||
|
@ -1103,11 +1112,9 @@ def baz():
|
||||||
yield i*i
|
yield i*i
|
||||||
|
|
||||||
class IteratorProxy(BaseProxy):
|
class IteratorProxy(BaseProxy):
|
||||||
_exposed_ = ('next', '__next__')
|
_exposed_ = ('__next__',)
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
def __next__(self):
|
|
||||||
return self._callmethod('next')
|
|
||||||
def __next__(self):
|
def __next__(self):
|
||||||
return self._callmethod('__next__')
|
return self._callmethod('__next__')
|
||||||
|
|
||||||
|
@ -1565,7 +1572,7 @@ class _TestSharedCTypes(BaseTestCase):
|
||||||
for i in range(len(arr)):
|
for i in range(len(arr)):
|
||||||
arr[i] *= 2
|
arr[i] *= 2
|
||||||
|
|
||||||
@unittest.skipIf(c_int is None, "requires _ctypes")
|
@unittest.skipIf(Value is None, "requires ctypes.Value")
|
||||||
def test_sharedctypes(self, lock=False):
|
def test_sharedctypes(self, lock=False):
|
||||||
x = Value('i', 7, lock=lock)
|
x = Value('i', 7, lock=lock)
|
||||||
y = Value(ctypes.c_double, 1.0/3.0, lock=lock)
|
y = Value(ctypes.c_double, 1.0/3.0, lock=lock)
|
||||||
|
@ -1586,13 +1593,14 @@ class _TestSharedCTypes(BaseTestCase):
|
||||||
self.assertAlmostEqual(arr[i], i*2)
|
self.assertAlmostEqual(arr[i], i*2)
|
||||||
self.assertEqual(string.value, latin('hellohello'))
|
self.assertEqual(string.value, latin('hellohello'))
|
||||||
|
|
||||||
|
@unittest.skipIf(Value is None, "requires ctypes.Value")
|
||||||
def test_synchronize(self):
|
def test_synchronize(self):
|
||||||
self.test_sharedctypes(lock=True)
|
self.test_sharedctypes(lock=True)
|
||||||
|
|
||||||
@unittest.skipIf(c_int is None, "requires _ctypes")
|
@unittest.skipIf(ctypes_copy is None, "requires ctypes.copy")
|
||||||
def test_copy(self):
|
def test_copy(self):
|
||||||
foo = _Foo(2, 5.0)
|
foo = _Foo(2, 5.0)
|
||||||
bar = copy(foo)
|
bar = ctypes_copy(foo)
|
||||||
foo.x = 0
|
foo.x = 0
|
||||||
foo.y = 0
|
foo.y = 0
|
||||||
self.assertEqual(bar.x, 2)
|
self.assertEqual(bar.x, 2)
|
||||||
|
|
|
@ -18,14 +18,14 @@ class PowTest(unittest.TestCase):
|
||||||
self.assertEquals(pow(2, i), pow2)
|
self.assertEquals(pow(2, i), pow2)
|
||||||
if i != 30 : pow2 = pow2*2
|
if i != 30 : pow2 = pow2*2
|
||||||
|
|
||||||
for othertype in int, int:
|
for othertype in (int,):
|
||||||
for i in list(range(-10, 0)) + list(range(1, 10)):
|
for i in list(range(-10, 0)) + list(range(1, 10)):
|
||||||
ii = type(i)
|
ii = type(i)
|
||||||
for j in range(1, 11):
|
for j in range(1, 11):
|
||||||
jj = -othertype(j)
|
jj = -othertype(j)
|
||||||
pow(ii, jj)
|
pow(ii, jj)
|
||||||
|
|
||||||
for othertype in int, int, float:
|
for othertype in int, float:
|
||||||
for i in range(1, 100):
|
for i in range(1, 100):
|
||||||
zero = type(0)
|
zero = type(0)
|
||||||
exp = -othertype(i/10.0)
|
exp = -othertype(i/10.0)
|
||||||
|
|
|
@ -79,7 +79,6 @@ class SysModuleTest(unittest.TestCase):
|
||||||
# Python/pythonrun.c::PyErr_PrintEx() is tricky.
|
# Python/pythonrun.c::PyErr_PrintEx() is tricky.
|
||||||
|
|
||||||
def test_exit(self):
|
def test_exit(self):
|
||||||
import subprocess
|
|
||||||
|
|
||||||
self.assertRaises(TypeError, sys.exit, 42, 42)
|
self.assertRaises(TypeError, sys.exit, 42, 42)
|
||||||
|
|
||||||
|
@ -458,7 +457,6 @@ class SysModuleTest(unittest.TestCase):
|
||||||
sys._clear_type_cache()
|
sys._clear_type_cache()
|
||||||
|
|
||||||
def test_ioencoding(self):
|
def test_ioencoding(self):
|
||||||
import subprocess,os
|
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
|
|
||||||
# Test character: cent sign, encoded as 0x4A (ASCII J) in CP424,
|
# Test character: cent sign, encoded as 0x4A (ASCII J) in CP424,
|
||||||
|
@ -480,7 +478,7 @@ class SysModuleTest(unittest.TestCase):
|
||||||
# Issue #7774: Ensure that sys.executable is an empty string if argv[0]
|
# Issue #7774: Ensure that sys.executable is an empty string if argv[0]
|
||||||
# has been set to an non existent program name and Python is unable to
|
# has been set to an non existent program name and Python is unable to
|
||||||
# retrieve the real program name
|
# retrieve the real program name
|
||||||
import subprocess
|
|
||||||
# For a normal installation, it should work without 'cwd'
|
# For a normal installation, it should work without 'cwd'
|
||||||
# argument. For test runs in the build directory, see #7774.
|
# argument. For test runs in the build directory, see #7774.
|
||||||
python_dir = os.path.dirname(os.path.realpath(sys.executable))
|
python_dir = os.path.dirname(os.path.realpath(sys.executable))
|
||||||
|
|
|
@ -103,7 +103,7 @@ class urlopen_FileTests(unittest.TestCase):
|
||||||
self.assertEqual(self.returned_obj.geturl(), self.pathname)
|
self.assertEqual(self.returned_obj.geturl(), self.pathname)
|
||||||
|
|
||||||
def test_getcode(self):
|
def test_getcode(self):
|
||||||
self.assertEqual(self.returned_obj.getcode(), None)
|
self.assertIsNone(self.returned_obj.getcode())
|
||||||
|
|
||||||
def test_iter(self):
|
def test_iter(self):
|
||||||
# Test iterator
|
# Test iterator
|
||||||
|
@ -132,7 +132,7 @@ class ProxyTests(unittest.TestCase):
|
||||||
self.env.set('NO_PROXY', 'localhost')
|
self.env.set('NO_PROXY', 'localhost')
|
||||||
proxies = urllib.request.getproxies_environment()
|
proxies = urllib.request.getproxies_environment()
|
||||||
# getproxies_environment use lowered case truncated (no '_proxy') keys
|
# getproxies_environment use lowered case truncated (no '_proxy') keys
|
||||||
self.assertEquals('localhost', proxies['no'])
|
self.assertEqual('localhost', proxies['no'])
|
||||||
|
|
||||||
|
|
||||||
class urlopen_HttpTests(unittest.TestCase):
|
class urlopen_HttpTests(unittest.TestCase):
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TrivialTests(unittest.TestCase):
|
||||||
('a="b\\"c", d="e\\,f", g="h\\\\i"',
|
('a="b\\"c", d="e\\,f", g="h\\\\i"',
|
||||||
['a="b"c"', 'd="e,f"', 'g="h\\i"'])]
|
['a="b"c"', 'd="e,f"', 'g="h\\i"'])]
|
||||||
for string, list in tests:
|
for string, list in tests:
|
||||||
self.assertEquals(urllib.request.parse_http_list(string), list)
|
self.assertEqual(urllib.request.parse_http_list(string), list)
|
||||||
|
|
||||||
|
|
||||||
def test_request_headers_dict():
|
def test_request_headers_dict():
|
||||||
|
@ -744,9 +744,9 @@ class HandlerTests(unittest.TestCase):
|
||||||
h.file_open(req)
|
h.file_open(req)
|
||||||
# XXXX remove OSError when bug fixed
|
# XXXX remove OSError when bug fixed
|
||||||
except (urllib.error.URLError, OSError):
|
except (urllib.error.URLError, OSError):
|
||||||
self.assertTrue(not ftp)
|
self.assertFalse(ftp)
|
||||||
else:
|
else:
|
||||||
self.assertTrue(o.req is req)
|
self.assertIs(o.req, req)
|
||||||
self.assertEqual(req.type, "ftp")
|
self.assertEqual(req.type, "ftp")
|
||||||
self.assertEqual(req.type is "ftp", ftp)
|
self.assertEqual(req.type is "ftp", ftp)
|
||||||
|
|
||||||
|
@ -849,19 +849,19 @@ class HandlerTests(unittest.TestCase):
|
||||||
# all 2xx are passed through
|
# all 2xx are passed through
|
||||||
r = MockResponse(200, "OK", {}, "", url)
|
r = MockResponse(200, "OK", {}, "", url)
|
||||||
newr = h.http_response(req, r)
|
newr = h.http_response(req, r)
|
||||||
self.assertTrue(r is newr)
|
self.assertIs(r, newr)
|
||||||
self.assertTrue(not hasattr(o, "proto")) # o.error not called
|
self.assertFalse(hasattr(o, "proto")) # o.error not called
|
||||||
r = MockResponse(202, "Accepted", {}, "", url)
|
r = MockResponse(202, "Accepted", {}, "", url)
|
||||||
newr = h.http_response(req, r)
|
newr = h.http_response(req, r)
|
||||||
self.assertTrue(r is newr)
|
self.assertIs(r, newr)
|
||||||
self.assertTrue(not hasattr(o, "proto")) # o.error not called
|
self.assertFalse(hasattr(o, "proto")) # o.error not called
|
||||||
r = MockResponse(206, "Partial content", {}, "", url)
|
r = MockResponse(206, "Partial content", {}, "", url)
|
||||||
newr = h.http_response(req, r)
|
newr = h.http_response(req, r)
|
||||||
self.assertTrue(r is newr)
|
self.assertIs(r, newr)
|
||||||
self.assertTrue(not hasattr(o, "proto")) # o.error not called
|
self.assertFalse(hasattr(o, "proto")) # o.error not called
|
||||||
# anything else calls o.error (and MockOpener returns None, here)
|
# anything else calls o.error (and MockOpener returns None, here)
|
||||||
r = MockResponse(502, "Bad gateway", {}, "", url)
|
r = MockResponse(502, "Bad gateway", {}, "", url)
|
||||||
self.assertTrue(h.http_response(req, r) is None)
|
self.assertIsNone(h.http_response(req, r))
|
||||||
self.assertEqual(o.proto, "http") # o.error called
|
self.assertEqual(o.proto, "http") # o.error called
|
||||||
self.assertEqual(o.args, (req, r, 502, "Bad gateway", {}))
|
self.assertEqual(o.args, (req, r, 502, "Bad gateway", {}))
|
||||||
|
|
||||||
|
@ -873,12 +873,14 @@ class HandlerTests(unittest.TestCase):
|
||||||
req = Request("http://example.com/")
|
req = Request("http://example.com/")
|
||||||
r = MockResponse(200, "OK", {}, "")
|
r = MockResponse(200, "OK", {}, "")
|
||||||
newreq = h.http_request(req)
|
newreq = h.http_request(req)
|
||||||
self.assertTrue(cj.ach_req is req is newreq)
|
self.assertIs(cj.ach_req, req)
|
||||||
self.assertEquals(req.get_origin_req_host(), "example.com")
|
self.assertIs(cj.ach_req, newreq)
|
||||||
self.assertTrue(not req.is_unverifiable())
|
self.assertEqual(req.get_origin_req_host(), "example.com")
|
||||||
|
self.assertFalse(req.is_unverifiable())
|
||||||
newr = h.http_response(req, r)
|
newr = h.http_response(req, r)
|
||||||
self.assertTrue(cj.ec_req is req)
|
self.assertIs(cj.ec_req, req)
|
||||||
self.assertTrue(cj.ec_r is r is newr)
|
self.assertIs(cj.ec_r, r)
|
||||||
|
self.assertIs(r, newr)
|
||||||
|
|
||||||
def test_redirect(self):
|
def test_redirect(self):
|
||||||
from_url = "http://example.com/a.html"
|
from_url = "http://example.com/a.html"
|
||||||
|
@ -906,7 +908,7 @@ class HandlerTests(unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
self.assertEqual(o.req.get_method(), "GET")
|
self.assertEqual(o.req.get_method(), "GET")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.assertTrue(not o.req.has_data())
|
self.assertFalse(o.req.has_data())
|
||||||
|
|
||||||
# now it's a GET, there should not be headers regarding content
|
# now it's a GET, there should not be headers regarding content
|
||||||
# (possibly dragged from before being a POST)
|
# (possibly dragged from before being a POST)
|
||||||
|
@ -965,7 +967,7 @@ class HandlerTests(unittest.TestCase):
|
||||||
cp = urllib.request.HTTPCookieProcessor(cj)
|
cp = urllib.request.HTTPCookieProcessor(cj)
|
||||||
o = build_test_opener(hh, hdeh, hrh, cp)
|
o = build_test_opener(hh, hdeh, hrh, cp)
|
||||||
o.open("http://www.example.com/")
|
o.open("http://www.example.com/")
|
||||||
self.assertTrue(not hh.req.has_header("Cookie"))
|
self.assertFalse(hh.req.has_header("Cookie"))
|
||||||
|
|
||||||
def test_proxy(self):
|
def test_proxy(self):
|
||||||
o = OpenerDirector()
|
o = OpenerDirector()
|
||||||
|
@ -1199,11 +1201,8 @@ class MiscTests(unittest.TestCase):
|
||||||
self.opener_has_handler(o, MyOtherHTTPHandler)
|
self.opener_has_handler(o, MyOtherHTTPHandler)
|
||||||
|
|
||||||
def opener_has_handler(self, opener, handler_class):
|
def opener_has_handler(self, opener, handler_class):
|
||||||
for h in opener.handlers:
|
self.assertTrue(any(h.__class__ == handler_class
|
||||||
if h.__class__ == handler_class:
|
for h in opener.handlers))
|
||||||
break
|
|
||||||
else:
|
|
||||||
self.assertTrue(False)
|
|
||||||
|
|
||||||
class RequestTests(unittest.TestCase):
|
class RequestTests(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -1218,7 +1217,7 @@ class RequestTests(unittest.TestCase):
|
||||||
self.assertEqual("GET", self.get.get_method())
|
self.assertEqual("GET", self.get.get_method())
|
||||||
|
|
||||||
def test_add_data(self):
|
def test_add_data(self):
|
||||||
self.assertTrue(not self.get.has_data())
|
self.assertFalse(self.get.has_data())
|
||||||
self.assertEqual("GET", self.get.get_method())
|
self.assertEqual("GET", self.get.get_method())
|
||||||
self.get.add_data("spam")
|
self.get.add_data("spam")
|
||||||
self.assertTrue(self.get.has_data())
|
self.assertTrue(self.get.has_data())
|
||||||
|
@ -1244,7 +1243,7 @@ class RequestTests(unittest.TestCase):
|
||||||
self.assertEqual("www.python.org", req.get_host())
|
self.assertEqual("www.python.org", req.get_host())
|
||||||
|
|
||||||
def test_proxy(self):
|
def test_proxy(self):
|
||||||
self.assertTrue(not self.get.has_proxy())
|
self.assertFalse(self.get.has_proxy())
|
||||||
self.get.set_proxy("www.perl.org", "http")
|
self.get.set_proxy("www.perl.org", "http")
|
||||||
self.assertTrue(self.get.has_proxy())
|
self.assertTrue(self.get.has_proxy())
|
||||||
self.assertEqual("www.python.org", self.get.get_origin_req_host())
|
self.assertEqual("www.python.org", self.get.get_origin_req_host())
|
||||||
|
|
|
@ -172,7 +172,7 @@ class DigestAuthHandler:
|
||||||
auth_validated = False
|
auth_validated = False
|
||||||
|
|
||||||
# MSIE uses short_path in its validation, but Python's
|
# MSIE uses short_path in its validation, but Python's
|
||||||
# urllib2 uses the full path, so we're going to see if
|
# urllib.request uses the full path, so we're going to see if
|
||||||
# either of them works here.
|
# either of them works here.
|
||||||
|
|
||||||
for path in [request_handler.path, request_handler.short_path]:
|
for path in [request_handler.path, request_handler.short_path]:
|
||||||
|
@ -298,8 +298,9 @@ def GetRequestHandler(responses):
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
body = self.send_head()
|
body = self.send_head()
|
||||||
if body:
|
while body:
|
||||||
self.wfile.write(body)
|
done = self.wfile.write(body)
|
||||||
|
body = body[done:]
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
content_length = self.headers["Content-Length"]
|
content_length = self.headers["Content-Length"]
|
||||||
|
@ -330,7 +331,7 @@ def GetRequestHandler(responses):
|
||||||
|
|
||||||
|
|
||||||
class TestUrlopen(unittest.TestCase):
|
class TestUrlopen(unittest.TestCase):
|
||||||
"""Tests urllib2.urlopen using the network.
|
"""Tests urllib.request.urlopen using the network.
|
||||||
|
|
||||||
These tests are not exhaustive. Assuming that testing using files does a
|
These tests are not exhaustive. Assuming that testing using files does a
|
||||||
good job overall of some of the basic interface features. There are no
|
good job overall of some of the basic interface features. There are no
|
||||||
|
@ -380,8 +381,8 @@ class TestUrlopen(unittest.TestCase):
|
||||||
|
|
||||||
handler = self.start_server(responses)
|
handler = self.start_server(responses)
|
||||||
data = self.urlopen("http://localhost:%s/" % handler.port)
|
data = self.urlopen("http://localhost:%s/" % handler.port)
|
||||||
self.assertEquals(data, expected_response)
|
self.assertEqual(data, expected_response)
|
||||||
self.assertEquals(handler.requests, ["/", "/somewhere_else"])
|
self.assertEqual(handler.requests, ["/", "/somewhere_else"])
|
||||||
|
|
||||||
def test_chunked(self):
|
def test_chunked(self):
|
||||||
expected_response = b"hello world"
|
expected_response = b"hello world"
|
||||||
|
@ -395,7 +396,7 @@ class TestUrlopen(unittest.TestCase):
|
||||||
response = [(200, [("Transfer-Encoding", "chunked")], chunked_start)]
|
response = [(200, [("Transfer-Encoding", "chunked")], chunked_start)]
|
||||||
handler = self.start_server(response)
|
handler = self.start_server(response)
|
||||||
data = self.urlopen("http://localhost:%s/" % handler.port)
|
data = self.urlopen("http://localhost:%s/" % handler.port)
|
||||||
self.assertEquals(data, expected_response)
|
self.assertEqual(data, expected_response)
|
||||||
|
|
||||||
def test_404(self):
|
def test_404(self):
|
||||||
expected_response = b"Bad bad bad..."
|
expected_response = b"Bad bad bad..."
|
||||||
|
@ -409,23 +410,23 @@ class TestUrlopen(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
self.fail("404 should raise URLError")
|
self.fail("404 should raise URLError")
|
||||||
|
|
||||||
self.assertEquals(data, expected_response)
|
self.assertEqual(data, expected_response)
|
||||||
self.assertEquals(handler.requests, ["/weeble"])
|
self.assertEqual(handler.requests, ["/weeble"])
|
||||||
|
|
||||||
def test_200(self):
|
def test_200(self):
|
||||||
expected_response = b"pycon 2008..."
|
expected_response = b"pycon 2008..."
|
||||||
handler = self.start_server([(200, [], expected_response)])
|
handler = self.start_server([(200, [], expected_response)])
|
||||||
data = self.urlopen("http://localhost:%s/bizarre" % handler.port)
|
data = self.urlopen("http://localhost:%s/bizarre" % handler.port)
|
||||||
self.assertEquals(data, expected_response)
|
self.assertEqual(data, expected_response)
|
||||||
self.assertEquals(handler.requests, ["/bizarre"])
|
self.assertEqual(handler.requests, ["/bizarre"])
|
||||||
|
|
||||||
def test_200_with_parameters(self):
|
def test_200_with_parameters(self):
|
||||||
expected_response = b"pycon 2008..."
|
expected_response = b"pycon 2008..."
|
||||||
handler = self.start_server([(200, [], expected_response)])
|
handler = self.start_server([(200, [], expected_response)])
|
||||||
data = self.urlopen("http://localhost:%s/bizarre" % handler.port,
|
data = self.urlopen("http://localhost:%s/bizarre" % handler.port,
|
||||||
b"get=with_feeling")
|
b"get=with_feeling")
|
||||||
self.assertEquals(data, expected_response)
|
self.assertEqual(data, expected_response)
|
||||||
self.assertEquals(handler.requests, ["/bizarre", b"get=with_feeling"])
|
self.assertEqual(handler.requests, ["/bizarre", b"get=with_feeling"])
|
||||||
|
|
||||||
def test_sending_headers(self):
|
def test_sending_headers(self):
|
||||||
handler = self.start_server()
|
handler = self.start_server()
|
||||||
|
@ -489,6 +490,25 @@ class TestUrlopen(unittest.TestCase):
|
||||||
urllib.request.urlopen,
|
urllib.request.urlopen,
|
||||||
"http://sadflkjsasf.i.nvali.d./")
|
"http://sadflkjsasf.i.nvali.d./")
|
||||||
|
|
||||||
|
def test_iteration(self):
|
||||||
|
expected_response = b"pycon 2008..."
|
||||||
|
handler = self.start_server([(200, [], expected_response)])
|
||||||
|
data = urllib.request.urlopen("http://localhost:%s" % handler.port)
|
||||||
|
for line in data:
|
||||||
|
self.assertEqual(line, expected_response)
|
||||||
|
|
||||||
|
def test_line_iteration(self):
|
||||||
|
lines = [b"We\n", b"got\n", b"here\n", b"verylong " * 8192 + b"\n"]
|
||||||
|
expected_response = b"".join(lines)
|
||||||
|
handler = self.start_server([(200, [], expected_response)])
|
||||||
|
data = urllib.request.urlopen("http://localhost:%s" % handler.port)
|
||||||
|
for index, line in enumerate(data):
|
||||||
|
self.assertEqual(line, lines[index],
|
||||||
|
"Fetched line number %s doesn't match expected:\n"
|
||||||
|
" Expected length was %s, got %s" %
|
||||||
|
(index, len(lines[index]), len(line)))
|
||||||
|
self.assertEqual(index + 1, len(lines))
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(ProxyAuthTests, TestUrlopen)
|
support.run_unittest(ProxyAuthTests, TestUrlopen)
|
||||||
|
|
||||||
|
|
|
@ -479,6 +479,8 @@ Build
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
|
||||||
|
|
||||||
- Issue #8857: Provide a test case for socket.getaddrinfo.
|
- Issue #8857: Provide a test case for socket.getaddrinfo.
|
||||||
|
|
||||||
- Issue #8433: Fix test_curses failure with newer versions of ncurses.
|
- Issue #8433: Fix test_curses failure with newer versions of ncurses.
|
||||||
|
|
63
Misc/README
63
Misc/README
|
@ -7,34 +7,35 @@ documents are only of historic importance.
|
||||||
Files found here
|
Files found here
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
ACKS Acknowledgements
|
ACKS Acknowledgements
|
||||||
AIX-NOTES Notes for building Python on AIX
|
AIX-NOTES Notes for building Python on AIX
|
||||||
build.sh Script to build and test latest Python from the repository
|
build.sh Script to build and test latest Python from the repository
|
||||||
cheatsheet Quick summary of Python by Ken Manheimer
|
cheatsheet Quick summary of Python by Ken Manheimer
|
||||||
developers.txt A history of who got developer permissions, and why
|
developers.txt A history of who got developer permissions, and why
|
||||||
gdbinit Handy stuff to put in your .gdbinit file, if you use gdb
|
gdbinit Handy stuff to put in your .gdbinit file, if you use gdb
|
||||||
HISTORY News from previous releases -- oldest last
|
HISTORY News from previous releases -- oldest last
|
||||||
indent.pro GNU indent profile approximating my C style
|
indent.pro GNU indent profile approximating my C style
|
||||||
maintainers.txt A list of maintainers for library modules
|
maintainers.rst A list of maintainers for library modules
|
||||||
NEWS News for this release (for some meaning of "this")
|
NEWS News for this release (for some meaning of "this")
|
||||||
NEWS.help How to edit NEWS
|
NEWS.help How to edit NEWS
|
||||||
Porting Mini-FAQ on porting to new platforms
|
Porting Mini-FAQ on porting to new platforms
|
||||||
PURIFY.README Information for Purify users
|
PURIFY.README Information for Purify users
|
||||||
pymemcompat.h Memory interface compatibility file.
|
pymemcompat.h Memory interface compatibility file.
|
||||||
python.man UNIX man page for the python interpreter
|
python-config.in Python script template for python-config
|
||||||
python-mode.el Emacs mode for editing Python programs
|
python.man UNIX man page for the python interpreter
|
||||||
python.pc.in Package configuration info template for pkg-config
|
python-mode.el Emacs mode for editing Python programs
|
||||||
python-wing.wpr Wing IDE project file
|
python.pc.in Package configuration info template for pkg-config
|
||||||
README The file you're reading now
|
python-wing.wpr Wing IDE project file
|
||||||
README.coverity Information about running Coverity's Prevent on Python
|
README The file you're reading now
|
||||||
README.klocwork Information about running Klocwork's K7 on Python
|
README.coverity Information about running Coverity's Prevent on Python
|
||||||
README.OpenBSD Help for building problems on OpenBSD
|
README.klocwork Information about running Klocwork's K7 on Python
|
||||||
README.valgrind Information for Valgrind users, see valgrind-python.supp
|
README.OpenBSD Help for building problems on OpenBSD
|
||||||
RFD Request For Discussion about a Python newsgroup
|
README.valgrind Information for Valgrind users, see valgrind-python.supp
|
||||||
RPM (Old) tools to build RPMs
|
RFD Request For Discussion about a Python newsgroup
|
||||||
setuid-prog.c C helper program for set-uid Python scripts
|
RPM (Old) tools to build RPMs
|
||||||
SpecialBuilds.txt Describes extra symbols you can set for debug builds
|
setuid-prog.c C helper program for set-uid Python scripts
|
||||||
TextMate A TextMate bundle for Python development
|
SpecialBuilds.txt Describes extra symbols you can set for debug builds
|
||||||
valgrind-python.supp Valgrind suppression file, see README.valgrind
|
TextMate A TextMate bundle for Python development
|
||||||
vgrindefs Python configuration for vgrind (a generic pretty printer)
|
valgrind-python.supp Valgrind suppression file, see README.valgrind
|
||||||
Vim Python development utilities for the Vim editor
|
vgrindefs Python configuration for vgrind (a generic pretty printer)
|
||||||
|
Vim Python development utilities for the Vim editor
|
||||||
|
|
|
@ -11,6 +11,10 @@ final judgement on a feature or bug. If no active maintainer is listed for
|
||||||
a given module, then questionable changes should go to python-dev, while
|
a given module, then questionable changes should go to python-dev, while
|
||||||
any other issues can and should be decided by any committer.
|
any other issues can and should be decided by any committer.
|
||||||
|
|
||||||
|
Unless a name is followed by a '*', you should never assign an issue to
|
||||||
|
that person, only make them nosy. Names followed by a '*' may be assigned
|
||||||
|
issues involving the module or topic for which the name has a '*'.
|
||||||
|
|
||||||
The Platform and Interest Area tables list broader fields in which various
|
The Platform and Interest Area tables list broader fields in which various
|
||||||
people have expertise. These people can also be contacted for help,
|
people have expertise. These people can also be contacted for help,
|
||||||
opinions, and decisions when issues involve their areas.
|
opinions, and decisions when issues involve their areas.
|
||||||
|
@ -21,8 +25,8 @@ in this list by placing the word 'inactive' in parenthesis behind their
|
||||||
tracker id. They are of course free to remove that inactive mark at
|
tracker id. They are of course free to remove that inactive mark at
|
||||||
any time.
|
any time.
|
||||||
|
|
||||||
Committers should update this table as their areas of expertise widen.
|
Committers should update these tables as their areas of expertise widen.
|
||||||
New topics may be added to the third table at will.
|
New topics may be added to the Interest Area table at will.
|
||||||
|
|
||||||
The existence of this list is not meant to indicate that these people
|
The existence of this list is not meant to indicate that these people
|
||||||
*must* be contacted for decisions; it is, rather, a resource to be used
|
*must* be contacted for decisions; it is, rather, a resource to be used
|
||||||
|
@ -85,10 +89,10 @@ dbm
|
||||||
decimal facundobatista, rhettinger, mark.dickinson
|
decimal facundobatista, rhettinger, mark.dickinson
|
||||||
difflib tim_one
|
difflib tim_one
|
||||||
dis
|
dis
|
||||||
distutils tarek
|
distutils tarek*, eric.araujo*
|
||||||
doctest tim_one (inactive)
|
doctest tim_one (inactive)
|
||||||
dummy_threading brett.cannon
|
dummy_threading brett.cannon
|
||||||
email barry, r.david.murray
|
email barry, r.david.murray*
|
||||||
encodings lemburg, loewis
|
encodings lemburg, loewis
|
||||||
errno
|
errno
|
||||||
exceptions
|
exceptions
|
||||||
|
@ -147,7 +151,7 @@ optparse aronacher
|
||||||
os loewis
|
os loewis
|
||||||
ossaudiodev
|
ossaudiodev
|
||||||
parser
|
parser
|
||||||
pdb georg.brandl
|
pdb georg.brandl*
|
||||||
pickle alexandre.vassalotti, pitrou
|
pickle alexandre.vassalotti, pitrou
|
||||||
pickletools alexandre.vassalotti
|
pickletools alexandre.vassalotti
|
||||||
pipes
|
pipes
|
||||||
|
@ -157,7 +161,8 @@ plistlib
|
||||||
poplib
|
poplib
|
||||||
posix
|
posix
|
||||||
pprint fdrake
|
pprint fdrake
|
||||||
pstats
|
profile georg.brandl
|
||||||
|
pstats georg.brandl
|
||||||
pty
|
pty
|
||||||
pwd
|
pwd
|
||||||
py_compile
|
py_compile
|
||||||
|
@ -167,7 +172,7 @@ pydoc
|
||||||
queue rhettinger
|
queue rhettinger
|
||||||
quopri
|
quopri
|
||||||
random rhettinger
|
random rhettinger
|
||||||
re effbot (inactive), pitrou
|
re effbot (inactive), pitrou, ezio.melotti
|
||||||
readline
|
readline
|
||||||
reprlib
|
reprlib
|
||||||
resource
|
resource
|
||||||
|
@ -189,7 +194,7 @@ spwd
|
||||||
sqlite3 ghaering
|
sqlite3 ghaering
|
||||||
ssl janssen, pitrou, giampaolo.rodola
|
ssl janssen, pitrou, giampaolo.rodola
|
||||||
stat
|
stat
|
||||||
string
|
string georg.brandl*
|
||||||
stringprep
|
stringprep
|
||||||
struct mark.dickinson
|
struct mark.dickinson
|
||||||
subprocess astrand (inactive)
|
subprocess astrand (inactive)
|
||||||
|
@ -202,18 +207,18 @@ syslog jafo
|
||||||
tabnanny tim_one
|
tabnanny tim_one
|
||||||
tarfile lars.gustaebel
|
tarfile lars.gustaebel
|
||||||
telnetlib
|
telnetlib
|
||||||
tempfile
|
tempfile georg.brandl
|
||||||
termios
|
termios
|
||||||
test
|
test
|
||||||
textwrap
|
textwrap georg.brandl
|
||||||
threading pitrou
|
threading pitrou
|
||||||
time alexander.belopolsky
|
time alexander.belopolsky
|
||||||
timeit
|
timeit georg.brandl
|
||||||
tkinter gpolo
|
tkinter gpolo
|
||||||
token georg.brandl
|
token georg.brandl
|
||||||
tokenize
|
tokenize
|
||||||
trace alexander.belopolsky
|
trace alexander.belopolsky
|
||||||
traceback georg.brandl
|
traceback georg.brandl*
|
||||||
tty
|
tty
|
||||||
turtle gregorlingl
|
turtle gregorlingl
|
||||||
types
|
types
|
||||||
|
@ -226,14 +231,21 @@ warnings brett.cannon
|
||||||
wave
|
wave
|
||||||
weakref fdrake, pitrou
|
weakref fdrake, pitrou
|
||||||
webbrowser georg.brandl
|
webbrowser georg.brandl
|
||||||
winreg
|
winreg brian.curtin
|
||||||
winsound effbot (inactive)
|
winsound effbot (inactive)
|
||||||
wsgiref pje
|
wsgiref pje
|
||||||
xdrlib
|
xdrlib
|
||||||
xml loewis
|
xml.dom
|
||||||
|
xml.dom.minidom
|
||||||
|
xml.dom.pulldom
|
||||||
xml.etree effbot (inactive)
|
xml.etree effbot (inactive)
|
||||||
|
xml.parsers.expat
|
||||||
|
xml.sax
|
||||||
|
xml.sax.handler
|
||||||
|
xml.sax.saxutils
|
||||||
|
xml.sax.xmlreader
|
||||||
xmlrpc loewis
|
xmlrpc loewis
|
||||||
zipfile
|
zipfile alanmcintyre
|
||||||
zipimport
|
zipimport
|
||||||
zlib
|
zlib
|
||||||
================== ===========
|
================== ===========
|
||||||
|
@ -243,6 +255,7 @@ zlib
|
||||||
Tool Maintainers
|
Tool Maintainers
|
||||||
------------------ -----------
|
------------------ -----------
|
||||||
pybench lemburg
|
pybench lemburg
|
||||||
|
================== ===========
|
||||||
|
|
||||||
|
|
||||||
================== ===========
|
================== ===========
|
||||||
|
@ -268,6 +281,7 @@ algorithms
|
||||||
ast/compiler ncoghlan, benjamin.peterson, brett.cannon, georg.brandl
|
ast/compiler ncoghlan, benjamin.peterson, brett.cannon, georg.brandl
|
||||||
autoconf/makefiles
|
autoconf/makefiles
|
||||||
bsd
|
bsd
|
||||||
|
bug tracker ezio.melotti
|
||||||
buildbots
|
buildbots
|
||||||
bytecode pitrou
|
bytecode pitrou
|
||||||
data formats mark.dickinson, georg.brandl
|
data formats mark.dickinson, georg.brandl
|
||||||
|
@ -286,10 +300,9 @@ py3 transition benjamin.peterson
|
||||||
release management tarek, lemburg, benjamin.peterson, barry, loewis,
|
release management tarek, lemburg, benjamin.peterson, barry, loewis,
|
||||||
gvanrossum, anthonybaxter
|
gvanrossum, anthonybaxter
|
||||||
str.format eric.smith
|
str.format eric.smith
|
||||||
|
testing michael.foord, pitrou, giampaolo.rodola
|
||||||
|
threads pitrou
|
||||||
time and dates lemburg
|
time and dates lemburg
|
||||||
testing michael.foord, pitrou
|
|
||||||
threads
|
|
||||||
tracker
|
|
||||||
unicode lemburg, ezio.melotti, haypo
|
unicode lemburg, ezio.melotti, haypo
|
||||||
version control
|
version control
|
||||||
================== ===========
|
================== ===========
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from lib2to3.main import main
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
from lib2to3.main import main
|
||||||
|
|
||||||
sys.exit(main("lib2to3.fixes"))
|
sys.exit(main("lib2to3.fixes"))
|
||||||
|
|
Loading…
Reference in New Issue