Skip to content

Commit 886af96

Browse files
committed
Merged revisions 78966,78970,79018,79026-79027,79055,79156,79159,79163-79164,79173,79176,79194,79208,79212 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78966 | florent.xicluna | 2010-03-14 10:20:59 -0500 (Sun, 14 Mar 2010) | 2 lines Do not hardcode Expat version. It's possible to build Python with --with-system-expat option. ........ r78970 | benjamin.peterson | 2010-03-14 21:58:24 -0500 (Sun, 14 Mar 2010) | 1 line this little exception dance is pointless ........ r79018 | collin.winter | 2010-03-16 22:04:01 -0500 (Tue, 16 Mar 2010) | 1 line Delete unused import. ........ r79026 | vinay.sajip | 2010-03-17 10:05:57 -0500 (Wed, 17 Mar 2010) | 1 line Issue python#8162: logging: Clarified docstring and documentation for disable function. ........ r79027 | collin.winter | 2010-03-17 12:36:16 -0500 (Wed, 17 Mar 2010) | 1 line Avoid hardcoding refcounts in tests. ........ r79055 | benjamin.peterson | 2010-03-18 16:30:48 -0500 (Thu, 18 Mar 2010) | 1 line remove installation of deleted test/output dir ........ r79156 | florent.xicluna | 2010-03-20 17:21:02 -0500 (Sat, 20 Mar 2010) | 2 lines Cleanup test_struct using check_warnings. ........ r79159 | florent.xicluna | 2010-03-20 17:26:42 -0500 (Sat, 20 Mar 2010) | 2 lines Cleanup test_tarfile, and use check_warnings. ........ r79163 | michael.foord | 2010-03-20 19:53:39 -0500 (Sat, 20 Mar 2010) | 1 line A faulty load_tests in a test module no longer halts test discovery. A placeholder test, that reports the failure, is created instead. ........ r79164 | michael.foord | 2010-03-20 19:55:58 -0500 (Sat, 20 Mar 2010) | 1 line Change order of arguments in a unittest function. ........ r79173 | georg.brandl | 2010-03-21 04:09:38 -0500 (Sun, 21 Mar 2010) | 1 line Document that GzipFile supports iteration. ........ r79176 | georg.brandl | 2010-03-21 04:17:41 -0500 (Sun, 21 Mar 2010) | 1 line Introduce copy by slicing, used in later chapters. ........ r79194 | florent.xicluna | 2010-03-21 06:58:11 -0500 (Sun, 21 Mar 2010) | 2 lines Use assertRaises and add a specific warning filter. ........ r79208 | andrew.kuchling | 2010-03-21 13:47:12 -0500 (Sun, 21 Mar 2010) | 1 line Add items ........ r79212 | georg.brandl | 2010-03-21 14:01:38 -0500 (Sun, 21 Mar 2010) | 1 line Fix plural. ........
1 parent 11dbfd4 commit 886af96

13 files changed

Lines changed: 71 additions & 37 deletions

File tree

Doc/library/gzip.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The module defines the following items:
6767
writing as *fileobj*, and retrieve the resulting memory buffer using the
6868
:class:`StringIO` object's :meth:`getvalue` method.
6969

70-
:class:`GzipFile` supports the :keyword:`with` statement.
70+
:class:`GzipFile` supports iteration and the :keyword:`with` statement.
7171

7272
.. versionchanged:: 3.1
7373
Support for the :keyword:`with` statement was added.

Doc/library/logging.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,11 @@ functions.
734734

735735
Provides an overriding level *lvl* for all loggers which takes precedence over
736736
the logger's own level. When the need arises to temporarily throttle logging
737-
output down across the whole application, this function can be useful.
737+
output down across the whole application, this function can be useful. Its
738+
effect is to disable all logging calls of severity *lvl* and below, so that
739+
if you call it with a value of INFO, then all INFO and DEBUG events would be
740+
discarded, whereas those of severity WARNING and above would be processed
741+
according to the logger's effective level.
738742

739743

740744
.. function:: addLevelName(lvl, levelName)

Doc/tutorial/introduction.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ concatenated and so on::
482482
>>> 3*a[:3] + ['Boo!']
483483
['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!']
484484

485+
All slice operations return a new list containing the requested elements. This
486+
means that the following slice returns a shallow copy of the list *a*::
487+
488+
>>> a[:]
489+
['spam', 'eggs', 100, 1234]
490+
485491
Unlike strings, which are *immutable*, it is possible to change individual
486492
elements of a list::
487493

Lib/compileall.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
9797
print('Compiling', fullname, '...')
9898
try:
9999
ok = py_compile.compile(fullname, None, dfile, True)
100-
except KeyboardInterrupt:
101-
raise KeyboardInterrupt
102100
except py_compile.PyCompileError as err:
103101
if quiet:
104102
print('*** Error compiling', fullname, '...')

Lib/ctypes/test/test_internals.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ def assertSame(self, a, b):
2323

2424
def test_ints(self):
2525
i = 42000123
26-
rc = grc(i)
26+
refcnt = grc(i)
2727
ci = c_int(i)
28-
self.assertEqual(rc, grc(i))
28+
self.assertEqual(refcnt, grc(i))
2929
self.assertEqual(ci._objects, None)
3030

3131
def test_c_char_p(self):
3232
s = b"Hello, World"
33-
rc = grc(s)
33+
refcnt = grc(s)
3434
cs = c_char_p(s)
35-
self.assertEqual(rc + 1, grc(s))
35+
self.assertEqual(refcnt + 1, grc(s))
3636
self.assertSame(cs._objects, s)
3737

3838
def test_simple_struct(self):

Lib/logging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ def log(level, msg, *args, **kwargs):
15551555

15561556
def disable(level):
15571557
"""
1558-
Disable all logging calls less severe than 'level'.
1558+
Disable all logging calls of severity 'level' and below.
15591559
"""
15601560
root.manager.disable = level
15611561

Lib/test/test_importhooks.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,9 @@ def testPathHook(self):
221221

222222
def testBlocker(self):
223223
mname = "exceptions" # an arbitrary harmless builtin module
224-
if mname in sys.modules:
225-
del sys.modules[mname]
224+
support.unload(mname)
226225
sys.meta_path.append(ImportBlocker(mname))
227-
try:
228-
__import__(mname)
229-
except ImportError:
230-
pass
231-
else:
232-
self.fail("'%s' was not supposed to be importable" % mname)
226+
self.assertRaises(ImportError, __import__, mname)
233227

234228
def testImpWrapper(self):
235229
i = ImpWrapper()

Lib/test/test_tarfile.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_fileobj_readlines(self):
6868
"fileobj.readlines() failed")
6969
self.assertTrue(len(lines2) == 114,
7070
"fileobj.readlines() failed")
71-
self.assertTrue(lines2[83] == \
71+
self.assertTrue(lines2[83] ==
7272
"I will gladly admit that Python is not the fastest running scripting language.\n",
7373
"fileobj.readlines() failed")
7474

@@ -706,11 +706,12 @@ def test_exclude(self):
706706
name = os.path.join(tempdir, name)
707707
open(name, "wb").close()
708708

709-
def exclude(name):
710-
return os.path.isfile(name)
709+
exclude = os.path.isfile
711710

712711
tar = tarfile.open(tmpname, self.mode, encoding="iso8859-1")
713-
tar.add(tempdir, arcname="empty_dir", exclude=exclude)
712+
with support.check_warnings(("use the filter argument",
713+
DeprecationWarning)):
714+
tar.add(tempdir, arcname="empty_dir", exclude=exclude)
714715
tar.close()
715716

716717
tar = tarfile.open(tmpname, "r")
@@ -888,10 +889,12 @@ def _test(self, name, link=None):
888889

889890
tar = tarfile.open(tmpname)
890891
member = tar.next()
891-
self.assertFalse(member is None, "unable to read longname member")
892-
self.assertTrue(tarinfo.name == member.name and \
893-
tarinfo.linkname == member.linkname, \
894-
"unable to read longname member")
892+
self.assertIsNotNone(member,
893+
"unable to read longname member")
894+
self.assertEqual(tarinfo.name, member.name,
895+
"unable to read longname member")
896+
self.assertEqual(tarinfo.linkname, member.linkname,
897+
"unable to read longname member")
895898

896899
def test_longname_1023(self):
897900
self._test(("longnam/" * 127) + "longnam")
@@ -993,7 +996,7 @@ def test_pax_global_header(self):
993996
"test": "\xe4\xf6\xfc",
994997
"\xe4\xf6\xfc": "test"}
995998

996-
tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \
999+
tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT,
9971000
pax_headers=pax_headers)
9981001
tar.addfile(tarfile.TarInfo("test"))
9991002
tar.close()

Lib/test/test_unittest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,21 @@ def load_tests(loader, tests, pattern):
291291
suite = loader.loadTestsFromModule(m, use_load_tests=False)
292292
self.assertEquals(load_tests_args, [])
293293

294+
def test_loadTestsFromModule__faulty_load_tests(self):
295+
m = types.ModuleType('m')
296+
297+
def load_tests(loader, tests, pattern):
298+
raise TypeError('some failure')
299+
m.load_tests = load_tests
300+
301+
loader = unittest.TestLoader()
302+
suite = loader.loadTestsFromModule(m)
303+
self.assertIsInstance(suite, unittest.TestSuite)
304+
self.assertEqual(suite.countTestCases(), 1)
305+
test = list(suite)[0]
306+
307+
self.assertRaisesRegexp(TypeError, "some failure", test.m)
308+
294309
################################################################
295310
### /Tests for TestLoader.loadTestsFromModule()
296311

Lib/test/test_xml_etree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ def parsefile():
597597
</ns0:root>
598598
599599
>>> parser = ET.XMLParser()
600-
>>> parser.version # XXX: Upgrade to 2.0.1?
601-
'Expat 2.0.0'
600+
>>> parser.version # doctest: +ELLIPSIS
601+
'Expat ...'
602602
>>> parser.feed(open(SIMPLE_XMLFILE).read())
603603
>>> print(serialize(parser.close()))
604604
<root>

0 commit comments

Comments
 (0)