Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
import sys
|
2003-01-16 08:02:35 -04:00
|
|
|
import unittest
|
2008-05-20 18:35:26 -03:00
|
|
|
from test import support
|
2008-02-12 16:03:09 -04:00
|
|
|
from collections import UserList
|
2000-12-28 22:06:45 -04:00
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
# We do a bit of trickery here to be able to test both the C implementation
|
|
|
|
# and the Python implementation of the module.
|
|
|
|
|
|
|
|
# Make it impossible to import the C implementation anymore.
|
|
|
|
sys.modules['_bisect'] = 0
|
|
|
|
# We must also handle the case that bisect was imported before.
|
|
|
|
if 'bisect' in sys.modules:
|
|
|
|
del sys.modules['bisect']
|
|
|
|
|
|
|
|
# Now we can import the module and get the pure Python implementation.
|
|
|
|
import bisect as py_bisect
|
|
|
|
|
|
|
|
# Restore everything to normal.
|
|
|
|
del sys.modules['_bisect']
|
|
|
|
del sys.modules['bisect']
|
2000-12-28 22:06:45 -04:00
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
# This is now the module with the C implementation.
|
|
|
|
import bisect as c_bisect
|
|
|
|
|
|
|
|
|
|
|
|
class TestBisect(unittest.TestCase):
|
|
|
|
module = None
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.precomputedCases = [
|
|
|
|
(self.module.bisect_right, [], 1, 0),
|
|
|
|
(self.module.bisect_right, [1], 0, 0),
|
|
|
|
(self.module.bisect_right, [1], 1, 1),
|
|
|
|
(self.module.bisect_right, [1], 2, 1),
|
|
|
|
(self.module.bisect_right, [1, 1], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 1], 1, 2),
|
|
|
|
(self.module.bisect_right, [1, 1], 2, 2),
|
|
|
|
(self.module.bisect_right, [1, 1, 1], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 1, 1], 1, 3),
|
|
|
|
(self.module.bisect_right, [1, 1, 1], 2, 3),
|
|
|
|
(self.module.bisect_right, [1, 1, 1, 1], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 1, 1, 1], 1, 4),
|
|
|
|
(self.module.bisect_right, [1, 1, 1, 1], 2, 4),
|
|
|
|
(self.module.bisect_right, [1, 2], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 2], 1, 1),
|
|
|
|
(self.module.bisect_right, [1, 2], 1.5, 1),
|
|
|
|
(self.module.bisect_right, [1, 2], 2, 2),
|
|
|
|
(self.module.bisect_right, [1, 2], 3, 2),
|
|
|
|
(self.module.bisect_right, [1, 1, 2, 2], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 1, 2, 2], 1, 2),
|
|
|
|
(self.module.bisect_right, [1, 1, 2, 2], 1.5, 2),
|
|
|
|
(self.module.bisect_right, [1, 1, 2, 2], 2, 4),
|
|
|
|
(self.module.bisect_right, [1, 1, 2, 2], 3, 4),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 1, 1),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 1.5, 1),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 2, 2),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 2.5, 2),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 3, 3),
|
|
|
|
(self.module.bisect_right, [1, 2, 3], 4, 3),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 0, 0),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1, 1),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1.5, 1),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2, 3),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2.5, 3),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3, 6),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3.5, 6),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 4, 10),
|
|
|
|
(self.module.bisect_right, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 5, 10),
|
|
|
|
|
|
|
|
(self.module.bisect_left, [], 1, 0),
|
|
|
|
(self.module.bisect_left, [1], 0, 0),
|
|
|
|
(self.module.bisect_left, [1], 1, 0),
|
|
|
|
(self.module.bisect_left, [1], 2, 1),
|
|
|
|
(self.module.bisect_left, [1, 1], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 1], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 1], 2, 2),
|
|
|
|
(self.module.bisect_left, [1, 1, 1], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 1], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 1], 2, 3),
|
|
|
|
(self.module.bisect_left, [1, 1, 1, 1], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 1, 1], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 1, 1], 2, 4),
|
|
|
|
(self.module.bisect_left, [1, 2], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 2], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 2], 1.5, 1),
|
|
|
|
(self.module.bisect_left, [1, 2], 2, 1),
|
|
|
|
(self.module.bisect_left, [1, 2], 3, 2),
|
|
|
|
(self.module.bisect_left, [1, 1, 2, 2], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 2, 2], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 1, 2, 2], 1.5, 2),
|
|
|
|
(self.module.bisect_left, [1, 1, 2, 2], 2, 2),
|
|
|
|
(self.module.bisect_left, [1, 1, 2, 2], 3, 4),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 1.5, 1),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 2, 1),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 2.5, 2),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 3, 2),
|
|
|
|
(self.module.bisect_left, [1, 2, 3], 4, 3),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 0, 0),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1, 0),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 1.5, 1),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2, 1),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 2.5, 3),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3, 3),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 3.5, 6),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 4, 6),
|
|
|
|
(self.module.bisect_left, [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], 5, 10)
|
|
|
|
]
|
2003-01-16 08:02:35 -04:00
|
|
|
|
|
|
|
def test_precomputed(self):
|
2003-01-16 10:00:15 -04:00
|
|
|
for func, data, elem, expected in self.precomputedCases:
|
|
|
|
self.assertEqual(func(data, elem), expected)
|
2004-01-05 06:13:35 -04:00
|
|
|
self.assertEqual(func(UserList(data), elem), expected)
|
2003-01-16 08:02:35 -04:00
|
|
|
|
Merged revisions 64722,64729,64753,64845-64846,64849,64871,64880-64882,64885,64888,64897,64900-64901,64915,64926-64929,64938-64941,64944,64961,64966,64973 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r64722 | georg.brandl | 2008-07-05 12:13:36 +0200 (Sat, 05 Jul 2008) | 4 lines
#2663: support an *ignore* argument to shutil.copytree(). Patch by Tarek Ziade.
This is a new feature, but Barry authorized adding it in the beta period.
........
r64729 | mark.dickinson | 2008-07-05 13:33:52 +0200 (Sat, 05 Jul 2008) | 5 lines
Issue 3188: accept float('infinity') as well as float('inf'). This
makes the float constructor behave in the same way as specified
by various other language standards, including C99, IEEE 754r,
and the IBM Decimal standard.
........
r64753 | gregory.p.smith | 2008-07-06 05:35:58 +0200 (Sun, 06 Jul 2008) | 4 lines
- Issue #2862: Make int and float freelist management consistent with other
freelists. Changes their CompactFreeList apis into ClearFreeList apis and
calls them via gc.collect().
........
r64845 | raymond.hettinger | 2008-07-10 16:03:19 +0200 (Thu, 10 Jul 2008) | 1 line
Issue 3301: Bisect functions behaved badly when lo was negative.
........
r64846 | raymond.hettinger | 2008-07-10 16:34:57 +0200 (Thu, 10 Jul 2008) | 1 line
Issue 3285: Fractions from_float() and from_decimal() accept Integral arguments.
........
r64849 | andrew.kuchling | 2008-07-10 16:43:31 +0200 (Thu, 10 Jul 2008) | 1 line
Wording changes
........
r64871 | raymond.hettinger | 2008-07-11 14:00:21 +0200 (Fri, 11 Jul 2008) | 1 line
Add cautionary note on the use of PySequence_Fast_ITEMS.
........
r64880 | amaury.forgeotdarc | 2008-07-11 23:28:25 +0200 (Fri, 11 Jul 2008) | 5 lines
#3317 in zipfile module, restore the previous names of global variables:
some applications relied on them.
Also remove duplicated lines.
........
r64881 | amaury.forgeotdarc | 2008-07-11 23:45:06 +0200 (Fri, 11 Jul 2008) | 3 lines
#3342: In tracebacks, printed source lines were not indented since r62555.
#3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine.
........
r64882 | josiah.carlson | 2008-07-12 00:17:14 +0200 (Sat, 12 Jul 2008) | 2 lines
Fix for the AttributeError in test_asynchat.
........
r64885 | josiah.carlson | 2008-07-12 01:26:59 +0200 (Sat, 12 Jul 2008) | 2 lines
Fixed test for asyncore.
........
r64888 | matthias.klose | 2008-07-12 09:51:48 +0200 (Sat, 12 Jul 2008) | 2 lines
- Fix bashisms in Tools/faqwiz/move-faqwiz.sh
........
r64897 | benjamin.peterson | 2008-07-12 22:16:19 +0200 (Sat, 12 Jul 2008) | 1 line
fix various doc typos #3320
........
r64900 | alexandre.vassalotti | 2008-07-13 00:06:53 +0200 (Sun, 13 Jul 2008) | 2 lines
Fixed typo.
........
r64901 | benjamin.peterson | 2008-07-13 01:41:19 +0200 (Sun, 13 Jul 2008) | 1 line
#1778443 robotparser fixes from Aristotelis Mikropoulos
........
r64915 | nick.coghlan | 2008-07-13 16:52:36 +0200 (Sun, 13 Jul 2008) | 1 line
Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError when the parent module can't be found during an absolute import (likely due to non-PEP 361 aware code which sets a module level __package__ attribute)
........
r64926 | martin.v.loewis | 2008-07-13 22:31:49 +0200 (Sun, 13 Jul 2008) | 2 lines
Add turtle into the module index.
........
r64927 | alexandre.vassalotti | 2008-07-13 22:42:44 +0200 (Sun, 13 Jul 2008) | 3 lines
Issue #3274: Use a less common identifier for the temporary variable
in Py_CLEAR().
........
r64928 | andrew.kuchling | 2008-07-13 23:43:25 +0200 (Sun, 13 Jul 2008) | 1 line
Re-word
........
r64929 | andrew.kuchling | 2008-07-13 23:43:52 +0200 (Sun, 13 Jul 2008) | 1 line
Add various items; move ctypes items into a subsection of their own
........
r64938 | andrew.kuchling | 2008-07-14 02:35:32 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fixes
........
r64939 | andrew.kuchling | 2008-07-14 02:40:55 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fix
........
r64940 | andrew.kuchling | 2008-07-14 03:18:16 +0200 (Mon, 14 Jul 2008) | 1 line
Typo fix
........
r64941 | andrew.kuchling | 2008-07-14 03:18:31 +0200 (Mon, 14 Jul 2008) | 1 line
Expand the multiprocessing section
........
r64944 | gregory.p.smith | 2008-07-14 08:06:48 +0200 (Mon, 14 Jul 2008) | 7 lines
Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child.
Does anyone actually use fork1()? It appears to be a Solaris thing
but if Python is built with pthreads on Solaris, fork1() and fork()
should be the same.
........
r64961 | jesse.noller | 2008-07-15 15:47:33 +0200 (Tue, 15 Jul 2008) | 1 line
multiprocessing/connection.py patch to remove fqdn oddness for issue 3270
........
r64966 | nick.coghlan | 2008-07-15 17:40:22 +0200 (Tue, 15 Jul 2008) | 1 line
Add missing NEWS entry for r64962
........
r64973 | jesse.noller | 2008-07-15 20:29:18 +0200 (Tue, 15 Jul 2008) | 1 line
Revert 3270 patch: self._address is in pretty widespread use, need to revisit
........
2008-07-16 09:55:28 -03:00
|
|
|
def test_negative_lo(self):
|
|
|
|
# Issue 3301
|
|
|
|
mod = self.module
|
|
|
|
self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3),
|
|
|
|
self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3),
|
|
|
|
self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3),
|
|
|
|
self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3),
|
|
|
|
|
2003-01-16 10:00:15 -04:00
|
|
|
def test_random(self, n=25):
|
2003-01-16 08:31:36 -04:00
|
|
|
from random import randrange
|
2007-05-07 19:24:25 -03:00
|
|
|
for i in range(n):
|
|
|
|
data = [randrange(0, n, 2) for j in range(i)]
|
2003-01-16 08:31:36 -04:00
|
|
|
data.sort()
|
2003-01-16 10:00:15 -04:00
|
|
|
elem = randrange(-1, n+1)
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
ip = self.module.bisect_left(data, elem)
|
2003-01-16 08:31:36 -04:00
|
|
|
if ip < len(data):
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(elem <= data[ip])
|
2003-01-16 08:31:36 -04:00
|
|
|
if ip > 0:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(data[ip-1] < elem)
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
ip = self.module.bisect_right(data, elem)
|
2003-01-16 08:31:36 -04:00
|
|
|
if ip < len(data):
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(elem < data[ip])
|
2003-01-16 08:31:36 -04:00
|
|
|
if ip > 0:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(data[ip-1] <= elem)
|
2003-01-16 08:31:36 -04:00
|
|
|
|
2003-01-16 09:02:25 -04:00
|
|
|
def test_optionalSlicing(self):
|
2003-01-16 10:00:15 -04:00
|
|
|
for func, data, elem, expected in self.precomputedCases:
|
2007-05-07 19:24:25 -03:00
|
|
|
for lo in range(4):
|
2003-01-16 10:00:15 -04:00
|
|
|
lo = min(len(data), lo)
|
2007-05-07 19:24:25 -03:00
|
|
|
for hi in range(3,8):
|
2003-01-16 10:00:15 -04:00
|
|
|
hi = min(len(data), hi)
|
|
|
|
ip = func(data, elem, lo, hi)
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(lo <= ip <= hi)
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
if func is self.module.bisect_left and ip < hi:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(elem <= data[ip])
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
if func is self.module.bisect_left and ip > lo:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(data[ip-1] < elem)
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
if func is self.module.bisect_right and ip < hi:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(elem < data[ip])
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
if func is self.module.bisect_right and ip > lo:
|
2009-08-13 05:51:18 -03:00
|
|
|
self.assertTrue(data[ip-1] <= elem)
|
2003-01-16 10:00:15 -04:00
|
|
|
self.assertEqual(ip, max(lo, min(hi, expected)))
|
2003-01-16 09:02:25 -04:00
|
|
|
|
|
|
|
def test_backcompatibility(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
self.assertEqual(self.module.bisect, self.module.bisect_right)
|
2003-01-16 09:02:25 -04:00
|
|
|
|
2005-10-05 08:39:12 -03:00
|
|
|
def test_keyword_args(self):
|
|
|
|
data = [10, 20, 30, 40, 50]
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
self.assertEqual(self.module.bisect_left(a=data, x=25, lo=1, hi=3), 2)
|
|
|
|
self.assertEqual(self.module.bisect_right(a=data, x=25, lo=1, hi=3), 2)
|
|
|
|
self.assertEqual(self.module.bisect(a=data, x=25, lo=1, hi=3), 2)
|
|
|
|
self.module.insort_left(a=data, x=25, lo=1, hi=3)
|
|
|
|
self.module.insort_right(a=data, x=25, lo=1, hi=3)
|
|
|
|
self.module.insort(a=data, x=25, lo=1, hi=3)
|
2005-10-05 08:39:12 -03:00
|
|
|
self.assertEqual(data, [10, 20, 25, 25, 25, 30, 40, 50])
|
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
class TestBisectPython(TestBisect):
|
|
|
|
module = py_bisect
|
|
|
|
|
|
|
|
class TestBisectC(TestBisect):
|
|
|
|
module = c_bisect
|
|
|
|
|
2003-01-16 08:02:35 -04:00
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
class TestInsort(unittest.TestCase):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
module = None
|
2003-01-16 08:02:35 -04:00
|
|
|
|
2004-01-05 06:13:35 -04:00
|
|
|
def test_vsBuiltinSort(self, n=500):
|
2003-01-16 08:02:35 -04:00
|
|
|
from random import choice
|
2004-01-05 06:13:35 -04:00
|
|
|
for insorted in (list(), UserList()):
|
2007-05-07 19:24:25 -03:00
|
|
|
for i in range(n):
|
2004-01-05 06:13:35 -04:00
|
|
|
digit = choice("0123456789")
|
|
|
|
if digit in "02468":
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
f = self.module.insort_left
|
2004-01-05 06:13:35 -04:00
|
|
|
else:
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
f = self.module.insort_right
|
2004-01-05 06:13:35 -04:00
|
|
|
f(insorted, digit)
|
|
|
|
self.assertEqual(sorted(insorted), insorted)
|
2003-01-16 08:02:35 -04:00
|
|
|
|
2003-01-16 09:02:25 -04:00
|
|
|
def test_backcompatibility(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
self.assertEqual(self.module.insort, self.module.insort_right)
|
|
|
|
|
2008-10-10 21:49:57 -03:00
|
|
|
def test_listDerived(self):
|
|
|
|
class List(list):
|
|
|
|
data = []
|
|
|
|
def insert(self, index, item):
|
|
|
|
self.data.insert(index, item)
|
|
|
|
|
|
|
|
lst = List()
|
|
|
|
self.module.insort_left(lst, 10)
|
|
|
|
self.module.insort_right(lst, 5)
|
|
|
|
self.assertEqual([5, 10], lst.data)
|
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
class TestInsortPython(TestInsort):
|
|
|
|
module = py_bisect
|
|
|
|
|
|
|
|
class TestInsortC(TestInsort):
|
|
|
|
module = c_bisect
|
2003-01-16 09:02:25 -04:00
|
|
|
|
2003-01-16 08:02:35 -04:00
|
|
|
#==============================================================================
|
2000-12-28 22:06:45 -04:00
|
|
|
|
2004-09-27 19:48:40 -03:00
|
|
|
|
|
|
|
class LenOnly:
|
|
|
|
"Dummy sequence class defining __len__ but not __getitem__."
|
|
|
|
def __len__(self):
|
|
|
|
return 10
|
|
|
|
|
|
|
|
class GetOnly:
|
|
|
|
"Dummy sequence class defining __getitem__ but not __len__."
|
|
|
|
def __getitem__(self, ndx):
|
|
|
|
return 10
|
|
|
|
|
|
|
|
class CmpErr:
|
|
|
|
"Dummy element that always raises an error during comparison"
|
2006-08-23 21:41:19 -03:00
|
|
|
def __lt__(self, other):
|
2004-09-27 19:48:40 -03:00
|
|
|
raise ZeroDivisionError
|
2006-08-23 21:41:19 -03:00
|
|
|
__gt__ = __lt__
|
|
|
|
__le__ = __lt__
|
|
|
|
__ge__ = __lt__
|
|
|
|
__eq__ = __lt__
|
|
|
|
__ne__ = __lt__
|
2004-09-27 19:48:40 -03:00
|
|
|
|
|
|
|
class TestErrorHandling(unittest.TestCase):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
module = None
|
2004-09-27 19:48:40 -03:00
|
|
|
|
|
|
|
def test_non_sequence(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
for f in (self.module.bisect_left, self.module.bisect_right,
|
|
|
|
self.module.insort_left, self.module.insort_right):
|
2004-09-27 19:48:40 -03:00
|
|
|
self.assertRaises(TypeError, f, 10, 10)
|
|
|
|
|
|
|
|
def test_len_only(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
for f in (self.module.bisect_left, self.module.bisect_right,
|
|
|
|
self.module.insort_left, self.module.insort_right):
|
2006-04-15 06:12:14 -03:00
|
|
|
self.assertRaises(TypeError, f, LenOnly(), 10)
|
2004-09-27 19:48:40 -03:00
|
|
|
|
|
|
|
def test_get_only(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
for f in (self.module.bisect_left, self.module.bisect_right,
|
|
|
|
self.module.insort_left, self.module.insort_right):
|
2006-04-15 06:12:14 -03:00
|
|
|
self.assertRaises(TypeError, f, GetOnly(), 10)
|
2004-09-27 19:48:40 -03:00
|
|
|
|
2004-09-27 20:11:35 -03:00
|
|
|
def test_cmp_err(self):
|
2004-09-27 19:48:40 -03:00
|
|
|
seq = [CmpErr(), CmpErr(), CmpErr()]
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
for f in (self.module.bisect_left, self.module.bisect_right,
|
|
|
|
self.module.insort_left, self.module.insort_right):
|
2004-09-27 19:48:40 -03:00
|
|
|
self.assertRaises(ZeroDivisionError, f, seq, 10)
|
|
|
|
|
|
|
|
def test_arg_parsing(self):
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
for f in (self.module.bisect_left, self.module.bisect_right,
|
|
|
|
self.module.insort_left, self.module.insort_right):
|
2004-09-27 19:48:40 -03:00
|
|
|
self.assertRaises(TypeError, f, 10)
|
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
class TestErrorHandlingPython(TestErrorHandling):
|
|
|
|
module = py_bisect
|
|
|
|
|
|
|
|
class TestErrorHandlingC(TestErrorHandling):
|
|
|
|
module = c_bisect
|
|
|
|
|
2004-09-27 19:48:40 -03:00
|
|
|
#==============================================================================
|
|
|
|
|
2003-01-16 08:31:36 -04:00
|
|
|
libreftest = """
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
Example from the Library Reference: Doc/library/bisect.rst
|
2003-01-16 08:31:36 -04:00
|
|
|
|
|
|
|
The bisect() function is generally useful for categorizing numeric data.
|
|
|
|
This example uses bisect() to look up a letter grade for an exam total
|
|
|
|
(say) based on a set of ordered numeric breakpoints: 85 and up is an `A',
|
|
|
|
75..84 is a `B', etc.
|
|
|
|
|
|
|
|
>>> grades = "FEDCBA"
|
|
|
|
>>> breakpoints = [30, 44, 66, 75, 85]
|
|
|
|
>>> from bisect import bisect
|
|
|
|
>>> def grade(total):
|
|
|
|
... return grades[bisect(breakpoints, total)]
|
|
|
|
...
|
|
|
|
>>> grade(66)
|
|
|
|
'C'
|
Merged revisions 56125-56153 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r56127 | georg.brandl | 2007-06-30 09:32:49 +0200 (Sat, 30 Jun 2007) | 2 lines
Fix a place where floor division would be in order.
........
r56135 | guido.van.rossum | 2007-07-01 06:13:54 +0200 (Sun, 01 Jul 2007) | 28 lines
Make map() and filter() identical to itertools.imap() and .ifilter(),
respectively.
I fixed two bootstrap issues, due to the dynamic import of itertools:
1. Starting python requires that map() and filter() are not used until
site.py has added build/lib.<arch> to sys.path.
2. Building python requires that setup.py and distutils and everything
they use is free of map() and filter() calls.
Beyond this, I only fixed the tests in test_builtin.py.
Others, please help fixing the remaining tests that are now broken!
The fixes are usually simple:
a. map(None, X) -> list(X)
b. map(F, X) -> list(map(F, X))
c. map(lambda x: F(x), X) -> [F(x) for x in X]
d. filter(F, X) -> list(filter(F, X))
e. filter(lambda x: P(x), X) -> [x for x in X if P(x)]
Someone, please also contribute a fixer for 2to3 to do this.
It can leave map()/filter() calls alone that are already
inside a list() or sorted() call or for-loop.
Only in rare cases have I seen code that depends on map() of lists
of different lengths going to the end of the longest, or on filter()
of a string or tuple returning an object of the same type; these
will need more thought to fix.
........
r56136 | guido.van.rossum | 2007-07-01 06:22:01 +0200 (Sun, 01 Jul 2007) | 3 lines
Make it so that test_decimal fails instead of hangs, to help automated
test runners.
........
r56139 | georg.brandl | 2007-07-01 18:20:58 +0200 (Sun, 01 Jul 2007) | 2 lines
Fix a few test cases after the map->imap change.
........
r56142 | neal.norwitz | 2007-07-02 06:38:12 +0200 (Mon, 02 Jul 2007) | 1 line
Get a bunch more tests passing after converting map/filter to return iterators.
........
r56147 | guido.van.rossum | 2007-07-02 15:32:02 +0200 (Mon, 02 Jul 2007) | 4 lines
Fix the remaining failing unit tests (at least on OSX).
Also tweaked urllib2 so it doesn't raise socket.gaierror when
all network interfaces are turned off.
........
2007-07-03 05:25:58 -03:00
|
|
|
>>> list(map(grade, [33, 99, 77, 44, 12, 88]))
|
2003-01-16 08:31:36 -04:00
|
|
|
['E', 'A', 'B', 'D', 'F', 'A']
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2003-01-16 08:02:35 -04:00
|
|
|
#------------------------------------------------------------------------------
|
2000-12-28 22:06:45 -04:00
|
|
|
|
2003-01-16 08:31:36 -04:00
|
|
|
__test__ = {'libreftest' : libreftest}
|
|
|
|
|
2003-01-16 08:02:35 -04:00
|
|
|
def test_main(verbose=None):
|
|
|
|
from test import test_bisect
|
2004-09-27 19:48:40 -03:00
|
|
|
|
Merged revisions 61003-61033 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61004 | georg.brandl | 2008-02-23 19:47:04 +0100 (Sat, 23 Feb 2008) | 2 lines
Documentation coverage builder, part 1.
........
r61006 | andrew.kuchling | 2008-02-23 20:02:33 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh.
........
r61008 | andrew.kuchling | 2008-02-23 20:28:58 +0100 (Sat, 23 Feb 2008) | 1 line
#1389051, #1092502: fix excessively large allocations when using read() on a socket
........
r61011 | jeffrey.yasskin | 2008-02-23 20:40:54 +0100 (Sat, 23 Feb 2008) | 13 lines
Prevent classes like:
class RunSelfFunction(object):
def __init__(self):
self.thread = threading.Thread(target=self._run)
self.thread.start()
def _run(self):
pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.
As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
........
r61013 | jeffrey.yasskin | 2008-02-23 21:40:35 +0100 (Sat, 23 Feb 2008) | 3 lines
Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
........
r61017 | georg.brandl | 2008-02-23 22:59:11 +0100 (Sat, 23 Feb 2008) | 2 lines
#2101: fix removeAttribute docs.
........
r61018 | georg.brandl | 2008-02-23 23:05:38 +0100 (Sat, 23 Feb 2008) | 2 lines
Add examples to modulefinder docs. Written for GHOP by Josip Dzolonga.
........
r61019 | georg.brandl | 2008-02-23 23:09:24 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange() in popen2.
........
r61020 | georg.brandl | 2008-02-23 23:14:02 +0100 (Sat, 23 Feb 2008) | 2 lines
Use os.closerange().
........
r61021 | georg.brandl | 2008-02-23 23:35:33 +0100 (Sat, 23 Feb 2008) | 3 lines
In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
........
r61024 | facundo.batista | 2008-02-23 23:54:12 +0100 (Sat, 23 Feb 2008) | 3 lines
Added simple test case. Thanks Benjamin Peterson.
........
r61025 | georg.brandl | 2008-02-23 23:55:18 +0100 (Sat, 23 Feb 2008) | 2 lines
#1825: correctly document msilib.add_data.
........
r61027 | georg.brandl | 2008-02-24 00:02:23 +0100 (Sun, 24 Feb 2008) | 2 lines
#1826: allow dotted attribute paths in operator.attrgetter.
........
r61028 | georg.brandl | 2008-02-24 00:04:35 +0100 (Sun, 24 Feb 2008) | 2 lines
#1506171: added operator.methodcaller().
........
r61029 | georg.brandl | 2008-02-24 00:25:26 +0100 (Sun, 24 Feb 2008) | 2 lines
Document import ./. threading issues. #1720705.
........
r61032 | georg.brandl | 2008-02-24 00:43:01 +0100 (Sun, 24 Feb 2008) | 2 lines
Specify what kind of warning -3 emits.
........
r61033 | christian.heimes | 2008-02-24 00:59:45 +0100 (Sun, 24 Feb 2008) | 1 line
MS Windows doesn't have mode_t but stat.st_mode is defined as unsigned short.
........
2008-02-23 20:38:49 -04:00
|
|
|
test_classes = [TestBisectPython, TestBisectC,
|
|
|
|
TestInsortPython, TestInsortC,
|
|
|
|
TestErrorHandlingPython, TestErrorHandlingC]
|
2004-09-27 19:48:40 -03:00
|
|
|
|
2008-05-20 18:35:26 -03:00
|
|
|
support.run_unittest(*test_classes)
|
|
|
|
support.run_doctest(test_bisect, verbose)
|
2000-12-28 22:06:45 -04:00
|
|
|
|
2004-09-27 19:48:40 -03:00
|
|
|
# verify reference counting
|
|
|
|
if verbose and hasattr(sys, "gettotalrefcount"):
|
|
|
|
import gc
|
|
|
|
counts = [None] * 5
|
2007-05-07 19:24:25 -03:00
|
|
|
for i in range(len(counts)):
|
2008-05-20 18:35:26 -03:00
|
|
|
support.run_unittest(*test_classes)
|
2004-09-27 19:48:40 -03:00
|
|
|
gc.collect()
|
|
|
|
counts[i] = sys.gettotalrefcount()
|
2007-02-09 01:37:30 -04:00
|
|
|
print(counts)
|
2004-09-27 19:48:40 -03:00
|
|
|
|
2003-01-16 08:02:35 -04:00
|
|
|
if __name__ == "__main__":
|
|
|
|
test_main(verbose=True)
|