Kaydet (Commit) 708c487a authored tarafından Georg Brandl's avatar Georg Brandl

Merged revisions 78035,78040,78043,78049-78050,78052-78054 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78035 | georg.brandl | 2010-02-06 23:44:17 +0100 (Sa, 06 Feb 2010) | 1 line

  Fix duplicate import.
........
  r78040 | georg.brandl | 2010-02-07 00:08:00 +0100 (So, 07 Feb 2010) | 1 line

  Fix a few UnboundLocalErrors in test_long.
........
  r78043 | georg.brandl | 2010-02-07 00:12:19 +0100 (So, 07 Feb 2010) | 1 line

  Remove duplicate test method.
........
  r78049 | georg.brandl | 2010-02-07 00:33:33 +0100 (So, 07 Feb 2010) | 1 line

  Fix import/access for some identifiers.  _TestSharedCTypes does not seem to be executed?
........
  r78050 | georg.brandl | 2010-02-07 00:34:10 +0100 (So, 07 Feb 2010) | 1 line

  Fix more unbound locals in code paths that do not seem to be used.
........
  r78052 | georg.brandl | 2010-02-07 00:54:04 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import when running these tests standalone.
........
  r78053 | georg.brandl | 2010-02-07 00:54:43 +0100 (So, 07 Feb 2010) | 1 line

  Fix some name errors in Mac modules.
........
  r78054 | georg.brandl | 2010-02-07 00:58:25 +0100 (So, 07 Feb 2010) | 1 line

  Add missing import.
........
üst 9d2fde72
...@@ -13,7 +13,7 @@ from cStringIO import StringIO ...@@ -13,7 +13,7 @@ from cStringIO import StringIO
from types import ListType from types import ListType
from email.test.test_email import TestEmailBase from email.test.test_email import TestEmailBase
from test.test_support import TestSkipped from test.test_support import TestSkipped, run_unittest
import email import email
from email import __file__ as testfile from email import __file__ as testfile
...@@ -128,7 +128,7 @@ def suite(): ...@@ -128,7 +128,7 @@ def suite():
def test_main(): def test_main():
for testclass in _testclasses(): for testclass in _testclasses():
test_support.run_unittest(testclass) run_unittest(testclass)
......
...@@ -15,7 +15,7 @@ class _MediaDescriptionCodec: ...@@ -15,7 +15,7 @@ class _MediaDescriptionCodec:
data = data[:self.size] data = data[:self.size]
values = struct.unpack(self.fmt, data) values = struct.unpack(self.fmt, data)
if len(values) != len(self.names): if len(values) != len(self.names):
raise Error, ('Format length does not match number of names', descr) raise Error, ('Format length does not match number of names')
rv = {} rv = {}
for i in range(len(values)): for i in range(len(values)):
name = self.names[i] name = self.names[i]
...@@ -26,7 +26,7 @@ class _MediaDescriptionCodec: ...@@ -26,7 +26,7 @@ class _MediaDescriptionCodec:
rv[name] = value rv[name] = value
return rv return rv
def encode(dict): def encode(self, dict):
list = [self.fmt] list = [self.fmt]
for name in self.names: for name in self.names:
if type(name) == type(()): if type(name) == type(()):
......
...@@ -426,7 +426,7 @@ class AppBuilder(BundleBuilder): ...@@ -426,7 +426,7 @@ class AppBuilder(BundleBuilder):
pass pass
elif self.mainprogram is not None: elif self.mainprogram is not None:
self.name = os.path.splitext(os.path.basename(self.mainprogram))[0] self.name = os.path.splitext(os.path.basename(self.mainprogram))[0]
elif executable is not None: elif self.executable is not None:
self.name = os.path.splitext(os.path.basename(self.executable))[0] self.name = os.path.splitext(os.path.basename(self.executable))[0]
if self.name[-4:] != ".app": if self.name[-4:] != ".app":
self.name += ".app" self.name += ".app"
......
...@@ -10,6 +10,7 @@ warnpy3k("In 3.x, the macostools module is removed.", stacklevel=2) ...@@ -10,6 +10,7 @@ warnpy3k("In 3.x, the macostools module is removed.", stacklevel=2)
from Carbon import Res from Carbon import Res
from Carbon import File, Files from Carbon import File, Files
import os import os
import errno
import MacOS import MacOS
try: try:
openrf = MacOS.openrf openrf = MacOS.openrf
......
...@@ -17,8 +17,9 @@ class SortedDict(UserDict.UserDict): ...@@ -17,8 +17,9 @@ class SortedDict(UserDict.UserDict):
return result return result
def values(self): def values(self):
# XXX never used?
result = self.items() result = self.items()
return [i[1] for i in values] return [i[1] for i in result]
def iteritems(self): return iter(self.items()) def iteritems(self): return iter(self.items())
def iterkeys(self): return iter(self.keys()) def iterkeys(self): return iter(self.keys())
......
...@@ -3,6 +3,7 @@ import httplib ...@@ -3,6 +3,7 @@ import httplib
from test import test_support from test import test_support
import threading import threading
import time import time
import socket
import unittest import unittest
import xmlrpclib import xmlrpclib
......
...@@ -506,7 +506,7 @@ class LongTest(unittest.TestCase): ...@@ -506,7 +506,7 @@ class LongTest(unittest.TestCase):
except OverflowError: except OverflowError:
self.fail("int(long(sys.maxint)) overflowed!") self.fail("int(long(sys.maxint)) overflowed!")
if not isinstance(x, int): if not isinstance(x, int):
raise TestFailed("int(long(sys.maxint)) should have returned int") self.fail("int(long(sys.maxint)) should have returned int")
x = int(hugeneg_aslong) x = int(hugeneg_aslong)
try: try:
self.assertEqual(x, hugeneg, self.assertEqual(x, hugeneg,
...@@ -514,8 +514,7 @@ class LongTest(unittest.TestCase): ...@@ -514,8 +514,7 @@ class LongTest(unittest.TestCase):
except OverflowError: except OverflowError:
self.fail("int(long(-sys.maxint-1)) overflowed!") self.fail("int(long(-sys.maxint-1)) overflowed!")
if not isinstance(x, int): if not isinstance(x, int):
raise TestFailed("int(long(-sys.maxint-1)) should have " self.fail("int(long(-sys.maxint-1)) should have returned int")
"returned int")
# but long -> int should overflow for hugepos+1 and hugeneg-1 # but long -> int should overflow for hugepos+1 and hugeneg-1
x = hugepos_aslong + 1 x = hugepos_aslong + 1
try: try:
...@@ -714,7 +713,7 @@ class LongTest(unittest.TestCase): ...@@ -714,7 +713,7 @@ class LongTest(unittest.TestCase):
self.d = d self.d = d
assert float(n) / float(d) == value assert float(n) / float(d) == value
else: else:
raise TypeError("can't deal with %r" % val) raise TypeError("can't deal with %r" % value)
def __cmp__(self, other): def __cmp__(self, other):
if not isinstance(other, Rat): if not isinstance(other, Rat):
......
...@@ -1295,12 +1295,13 @@ class MinidomTest(unittest.TestCase): ...@@ -1295,12 +1295,13 @@ class MinidomTest(unittest.TestCase):
self.confirm(len(n1.entities) == len(n2.entities) self.confirm(len(n1.entities) == len(n2.entities)
and len(n1.notations) == len(n2.notations)) and len(n1.notations) == len(n2.notations))
for i in range(len(n1.notations)): for i in range(len(n1.notations)):
# XXX this loop body doesn't seem to be executed?
no1 = n1.notations.item(i) no1 = n1.notations.item(i)
no2 = n1.notations.item(i) no2 = n1.notations.item(i)
self.confirm(no1.name == no2.name self.confirm(no1.name == no2.name
and no1.publicId == no2.publicId and no1.publicId == no2.publicId
and no1.systemId == no2.systemId) and no1.systemId == no2.systemId)
statck.append((no1, no2)) stack.append((no1, no2))
for i in range(len(n1.entities)): for i in range(len(n1.entities)):
e1 = n1.entities.item(i) e1 = n1.entities.item(i)
e2 = n2.entities.item(i) e2 = n2.entities.item(i)
......
...@@ -1560,10 +1560,10 @@ class _TestSharedCTypes(BaseTestCase): ...@@ -1560,10 +1560,10 @@ class _TestSharedCTypes(BaseTestCase):
return return
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(c_double, 1.0/3.0, lock=lock)
foo = Value(_Foo, 3, 2, lock=lock) foo = Value(_Foo, 3, 2, lock=lock)
arr = Array('d', range(10), lock=lock) arr = self.Array('d', range(10), lock=lock)
string = Array('c', 20, lock=lock) string = self.Array('c', 20, lock=lock)
string.value = 'hello' string.value = 'hello'
p = self.Process(target=self._double, args=(x, y, foo, arr, string)) p = self.Process(target=self._double, args=(x, y, foo, arr, string))
......
...@@ -128,8 +128,10 @@ class PlatformTest(unittest.TestCase): ...@@ -128,8 +128,10 @@ class PlatformTest(unittest.TestCase):
if os.path.isdir(sys.executable) and \ if os.path.isdir(sys.executable) and \
os.path.exists(sys.executable+'.exe'): os.path.exists(sys.executable+'.exe'):
# Cygwin horror # Cygwin horror
executable = executable + '.exe' executable = sys.executable + '.exe'
res = platform.libc_ver(sys.executable) else:
executable = sys.executable
res = platform.libc_ver(executable)
def test_parse_release_file(self): def test_parse_release_file(self):
......
...@@ -298,14 +298,6 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' ...@@ -298,14 +298,6 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]), ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]),
]) ])
def test_illegal_declarations(self):
s = 'abc<!spacer type="block" height="25">def'
self.check_events(s, [
("data", "abc"),
("unknown decl", 'spacer type="block" height="25"'),
("data", "def"),
])
def test_weird_starttags(self): def test_weird_starttags(self):
self.check_events("<a<a>", [ self.check_events("<a<a>", [
("starttag", "a", []), ("starttag", "a", []),
......
...@@ -28,7 +28,6 @@ import os ...@@ -28,7 +28,6 @@ import os
import time import time
import sys import sys
from urlparse import urljoin as basejoin from urlparse import urljoin as basejoin
import warnings
__all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve",
"urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus",
...@@ -72,7 +71,7 @@ _urlopener = None ...@@ -72,7 +71,7 @@ _urlopener = None
def urlopen(url, data=None, proxies=None): def urlopen(url, data=None, proxies=None):
"""Create a file-like object for the specified URL to read from.""" """Create a file-like object for the specified URL to read from."""
from warnings import warnpy3k from warnings import warnpy3k
warnings.warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " warnpy3k("urllib.urlopen() has been removed in Python 3.0 in "
"favor of urllib2.urlopen()", stacklevel=2) "favor of urllib2.urlopen()", stacklevel=2)
global _urlopener global _urlopener
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment