Commit Graph

5292 Commits

Author SHA1 Message Date
Georg Brandl 853e44ca8c The bug for which there was a test in outstanding_bugs.py was agreed not to be a bug. 2008-03-27 13:34:59 +00:00
Christian Heimes 6c052fd523 Fixed tokenize tests
The tokenize module doesn't understand __future__.unicode_literals yet
2008-03-27 11:46:37 +00:00
Eric Smith 23a48ad101 Added test cases for single quoted strings, both forms of triple quotes,
and some string concatenations.
Removed unneeded __future__ print_function import.
2008-03-27 09:42:35 +00:00
Christian Heimes 3784c6b1af Use the new unicode literals for the io module
use basestring instead of str in Python 2.x
2008-03-26 23:13:59 +00:00
Christian Heimes fa50bad957 I forgot to svn add the future test 2008-03-26 22:55:31 +00:00
Christian Heimes 1a6387e683 Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray

........
  r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line

  Copied files from py3k w/o modifications
........
  r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines

  Take One
  * Added initialization code, warnings, flags etc. to the appropriate places
  * Added new buffer interface to string type
  * Modified tests
  * Modified Makefile.pre.in to compile the new files
  * Added bytesobject.c to Python.h
........
  r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines

  Disabled bytearray.extend for now since it causes an infinite recursion
  Fixed serveral unit tests
........
  r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines

  Added PyBytes support to several places:
  str + bytearray
  ord(bytearray)
  bytearray(str, encoding)
........
  r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line

  Fixed more unit tests related to type('') is not unicode
........
  r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fixed more unit tests
  Fixed bytearray.extend
........
  r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line

  Implemented old buffer interface for bytearray
........
  r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line

  Added backport of the io module
........
  r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line

  Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
  r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines

  Fixed more tests
  Fixed bytearray() comparsion with unicode()
  Fixed iterator assignment of bytearray
........
  r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines

  str(bytesarray()) now returns the bytes and not the representation of the bytearray object
  Enabled and fixed more unit tests
........
  r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines

  Clear error PyNumber_AsSsize_t() fails
  Use CHARMASK for ob_svall access
  disabled a test with memoryview again
........
  r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line

  Untested updates to the PCBuild directory
........
  r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line

  The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
  r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines

  Disabled last failing test
  I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
  r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytes warning code
........
  r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line

  Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
  r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 12:49:49 +00:00
Jerry Seutter fc7b3e3aa2 Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:58:14 +00:00
Jerry Seutter 9f7af8d4da Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:32:51 +00:00
Neal Norwitz 22b3e3aff8 Ensure that the mailbox is closed to prevent problems on Windows with removing
an open file.  This doesn't seem to be a problem in 2.6, but that appears
to be somewhat accidental (specific to reference counting).  When this
gets merged to 3.0, it will make the 3.0 code simpler.
2008-03-26 05:19:41 +00:00
Jerry Seutter 14f0bc7900 Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:03:03 +00:00
Neal Norwitz 85fc3c1f1c Try to get this test to be less flaky. It was failing sometimes because
the connect would succeed before the timeout occurred.  Try using an
address and port that hopefully doesn't exist to ensure we get no response.
If this doesn't work, we can use a public address close to python.org
and hopefully that address never gets taken.
2008-03-26 04:55:51 +00:00
Mark Dickinson 8e85ffa4b2 Issue #2482: Make sure that the coefficient of a Decimal
instance is always stored as a str instance, even
when that Decimal has been created from a unicode string.
2008-03-25 18:47:59 +00:00
Mark Dickinson 3b24ccbe7e Issue #2478: Decimal(sqrt(0)) failed when the decimal context
was not explicitly supplied.
2008-03-25 14:33:23 +00:00
Georg Brandl d5b635f196 Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
2008-03-25 08:29:14 +00:00
Georg Brandl 80055f6295 #2355: py3k warning for buffer(). 2008-03-25 07:56:27 +00:00
Neal Norwitz bb89e686e3 Try to get this test to be more stable:
* disable gc during the test run because we are spawning objects and there
   was an exception when calling Popen.__del__
 * Always set an alarm handler so the process doesn't exit if the test fails
   (should probably add assertions on the value of hndl_called in more places)
 * Using a negative time causes Linux to treat it as zero, so disable that test.
2008-03-25 07:00:39 +00:00
Neal Norwitz be9160b035 Don't try to close a non-open file.
Don't let file removal cause the test to fail.
2008-03-25 06:35:10 +00:00
Gregory P. Smith 88440960f9 A stab in the dark attempt to fix the alpha/tru64 buildbot problem and add more
test coverage of valid inputs to zlib.crc32.
2008-03-25 06:12:45 +00:00
Neal Norwitz 40f5e4c5a2 Fix a bunch of UnboundLocalErrors when the tests fail. 2008-03-25 04:17:38 +00:00
Martin v. Löwis aef18b1c67 Patch #2240: Implement signal.setitimer and signal.getitimer. 2008-03-24 13:31:16 +00:00
Raymond Hettinger bbc50eafe5 Issue 1681432: Add triangular distribution the random module. 2008-03-23 13:32:32 +00:00
Amaury Forgeot d'Arc 9a0d3462fc #1477: ur'\U0010FFFF' raised in narrow unicode builds.
Corrected the raw-unicode-escape codec to use UTF-16 surrogates in
this case, just like the unicode-escape codec.
2008-03-23 09:55:29 +00:00
Neal Norwitz acdb6fb2a5 Try to prevent the alarm going off early in tearDown 2008-03-23 06:16:04 +00:00
Neal Norwitz 41d649116c Suppress failure (to avoid a flaky test) if we cannot connect to svn.python.org 2008-03-23 05:47:20 +00:00
Neal Norwitz 3bda069c5a Skip the epoll test if epoll() does not work 2008-03-23 04:43:09 +00:00
Neal Norwitz 162d719113 Speed up the test by avoiding socket timeouts. 2008-03-23 04:08:30 +00:00
Neal Norwitz 1f2995b014 Try to make this test a little more robust and not fail with:
timeout (10.0025) is more than 2 seconds more than expected (0.001)

I'm assuming this problem is caused by DNS lookup.  This change
does a DNS lookup of the hostname before trying to connect, so the time
is not included.
2008-03-23 03:43:33 +00:00
Raymond Hettinger e70bb8d6f2 Simplify demo code. 2008-03-23 00:55:46 +00:00
Facundo Batista 6415667fe2 Small fix that complicated the test actually when that
test failed.
2008-03-22 02:45:37 +00:00
Christian Heimes 0e9ab5f2f0 Applied patch #1657 epoll and kqueue wrappers for the select module
The patch adds wrappers for the Linux epoll syscalls and the BSD kqueue syscalls. Thanks to Thomas Herve and the Twisted people for their support and help.
TODO: Finish documentation documentation
2008-03-21 23:49:44 +00:00
Steven Bethard d290b04ee3 Replace hack in regrtest.py with use of sys.py3kwarning. 2008-03-21 21:01:18 +00:00
Georg Brandl 65bb42dc1b #2348: add py3k warning for file.softspace. 2008-03-21 20:38:24 +00:00
Georg Brandl 07e5681fd3 #2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich. 2008-03-21 20:21:46 +00:00
Georg Brandl 5a44424c5e #2358: add py3k warning to sys.exc_clear(). 2008-03-21 20:11:46 +00:00
Georg Brandl 77354cf5ef Issue #2432: give DictReader the dialect and line_num attributes
advertised in the docs.
2008-03-21 20:01:51 +00:00
Georg Brandl 331243270d #2136: allow single quotes in realm spec. 2008-03-21 19:54:00 +00:00
Jeffrey Yasskin 510eab5965 Speed test_threading up from 14s to .5s, and avoid a deadlock on certain
failures. The test for enumerate-after-join is now a little less rigorous, but
the bug it references says the error happened in the first couple iterations,
so 100 iterations should still be enough.

cProfile was useful for identifying the slow tests here.
2008-03-21 18:48:04 +00:00
Jeffrey Yasskin 413f588a36 Try to fix test_signal on FreeBSD. I'm assuming that os.kill is failing to
raise a signal, but switching to subprocess makes the code cleaner anyway.
2008-03-21 18:25:06 +00:00
Jeffrey Yasskin 6cda88ea11 Try to fix test_signal breakages on Linux due to r61687. It appears that at
least two of the linux build bots aren't leaving zombie processes around for
os.waitpid to wait for, causing ECHILD errors. This would be a symptom of a bug
somewhere, but probably not in signal itself.
2008-03-21 05:51:37 +00:00
Jeffrey Yasskin cf26f5419e Speed up test_signal from ~24s to 4s by avoiding nearly all of the sleep calls. 2008-03-21 05:02:44 +00:00
Eric Smith 816a168053 Comment how 'from __future__ import print_function' operates in 3.0. 2008-03-20 23:56:08 +00:00
Gregory P. Smith 6af3db8632 Attempt to fix the Solaris Sparc 10 buildbot. It was failing with an invalid
argument error on ioctl.  This was caused by the added test_fcntl ioctl test
that hard coded 0 as the fd to use.  Without a terminal, this fails on solaris.
(it passed from the command line on sol 10, both 32 and 64 bit)

Also, test_ioctl exists so I moved the test into there where it belongs.
2008-03-20 05:41:53 +00:00
Trent Nelson 00b53ea1b8 Revert r61650; the intent of this commit was to try and address alarm failures on some of the build slaves. As Neal points out, it's called after test_main(), so it's not going to factor into the test when run via regrtest.py (and removes the original functionality that Jeffrey wanted that would kill the test if it took longer than 3 seconds to run when executing it directly during development). 2008-03-20 00:58:44 +00:00
Gregory P. Smith a5cfcad0e3 Prevent ioctl op codes from being sign extended from int to unsigned long
when used on platforms that actually define ioctl as taking an unsigned long.
(the BSDs and OS X / Darwin)

Adds a unittest for fcntl.ioctl that tests what happens with both positive and
negative numbers.

This was done because of issue1471 but I'm not able to reproduce -that- problem
in the first place on Linux 32bit or 64bit or OS X 10.4 & 10.5 32bit or 64 bit.
2008-03-19 23:03:25 +00:00
Brett Cannon 48581c5f08 Make sure that the warnings filter is not reset or changed beyond the current
running test file.

Closes issue2407. Thanks Jerry Seutter.
2008-03-19 23:01:17 +00:00
Trent Nelson a0ce6b6b71 Bump the SIGALM delay from 3 seconds to 20 seconds, mainly in an effort to see if it fixes the alarm failures in this test experienced by some of the buildbots. 2008-03-19 22:51:42 +00:00
Raymond Hettinger 10dca6e282 The filter() function does support a None argument in Py3.0. 2008-03-19 17:58:59 +00:00
Raymond Hettinger 05387861ea Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh. 2008-03-19 17:45:19 +00:00
Brett Cannon 977eb021f3 Use sys.py3kwarning instead of trying to trigger a Py3k-related warning. 2008-03-19 17:37:43 +00:00
Brett Cannon 7919d98d56 test_nis would fail if test.test_support.verbose was true but NIS was not set
up on the machine.

Closes issue2411. Thanks Michael Bishop.
2008-03-19 16:50:13 +00:00
Eric Smith 8ff4963594 Trivial typo. 2008-03-19 12:15:10 +00:00
Eric Smith e504445972 Use test.test_support.captured_stdout instead of a custom contextmanager.
Thanks Nick Coghlan.
2008-03-19 12:09:55 +00:00
Martin v. Löwis 16b2e6bd7f Import relimport using a relative import. 2008-03-19 06:00:28 +00:00
Martin v. Löwis a4d77898db Issue #2400: Allow relative imports to "import *". 2008-03-19 04:39:13 +00:00
Eric Smith 14cae96fa6 Another test for __future__ print_function. 2008-03-19 03:13:34 +00:00
David Wolever 2724ab99c8 Added zip, map, filter to future_bultins (#2171) 2008-03-19 02:35:45 +00:00
Eric Smith 7c47894a2a Backport of the print function, using a __future__ import.
This work is substantially Anthony Baxter's, from issue
1633807.  I just freshened it, made a few minor tweaks,
and added the test cases.  I also created issue 2412,
which is to check for 2to3's behavior with the print
function.  I also added myself to ACKS.
2008-03-18 23:45:49 +00:00
Gregory P. Smith c856fa811d Add a test to make sure zlib.crc32 and binascii.crc32 return the same thing.
Fix a buglet in binascii.crc32, the second optional argument could previously
have a signedness mismatch with the C variable its going into.
2008-03-18 22:27:41 +00:00
Steven Bethard 6a644f92ef Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code. 2008-03-18 22:08:20 +00:00
Steven Bethard e8e22cf3c0 Have regrtest skip test_py3kwarn when the -3 flag is missing. 2008-03-18 21:30:13 +00:00
Neal Norwitz 0c1ef470f8 Import the test properly. This is especially important for py3k. 2008-03-18 20:30:38 +00:00
Steven Bethard a7a3e28e4e Fix test_atexit so that it still passes when -3 is supplied. (It was catching the warning messages on stdio from using the reload() function.) 2008-03-18 19:59:14 +00:00
Gregory P. Smith f48da8fbcd Fix chown on 64-bit linux. It needed to take a long (64-bit on 64bit linux) as
uid and gid input to accept values >=2**31 as valid while still accepting
negative numbers to pass -1 to chown for "no change".

Fixes issue1747858.

This should be backported to release25-maint.
2008-03-18 19:05:32 +00:00
Steven Bethard 8906575380 _have_soundcard() is a bad check for winsound.Beep, since you can have a soundcard but have the beep driver disabled. This revision basically disables the beep tests by wrapping them in a try/except. The Right Way To Do It is to come up with a _have_enabled_beep_driver() and use that. 2008-03-18 19:04:32 +00:00
Neal Norwitz 5fe5cf6df2 Get regrtest working when re-running tests 2008-03-18 17:58:02 +00:00
Steven Bethard ae42f33cdf Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373. 2008-03-18 17:26:10 +00:00
Sean Reifscheider 493894c3e0 Issue 1577: shutil.move() where destination is a directory was doing a
copy, now it is doing a os.rename() if it's on the same file-system.
2008-03-18 17:24:12 +00:00
Steven Bethard ed427e7be9 Use test_support.unlink instead of os.unlink in tearDown(). (Seems to fix an occasional failure in Windows Vista.) 2008-03-18 16:00:19 +00:00
Brett Cannon f084e04820 Fix test_errno to only check for error numbers that are defined by Standard C. 2008-03-18 15:52:00 +00:00
Martin v. Löwis 66e2663eba Note that the stderr output of the test is intentional. 2008-03-18 13:16:05 +00:00
Martin v. Löwis afb416b002 Add WSA errors. 2008-03-18 13:05:03 +00:00
Martin v. Löwis 637f239bbb Add more Linux error codes. 2008-03-18 12:45:37 +00:00
Martin v. Löwis d43ca3b395 norwitz-amd64 (gentoo) has EREMOTEIO. 2008-03-18 12:20:15 +00:00
Trent Nelson 496ad27186 The behaviour of winsound.Beep() seems to differ between different versions of Windows when there's either:
a) no sound card entirely
    b) legacy beep driver has been disabled
    c) the legacy beep driver has been uninstalled
Sometimes RuntimeErrors are raised, sometimes they're not.  If _have_soundcard() returns False, don't expect winsound.Beep() to raise a RuntimeError, as this clearly isn't the case, as demonstrated by the various Win32 XP buildbots.
2008-03-18 07:32:47 +00:00
Neal Norwitz d1befd7c50 Add some info to the failure messages 2008-03-18 06:03:46 +00:00
Jeffrey Yasskin 36dbcb9e98 Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
their times.
2008-03-18 05:45:40 +00:00
Brett Cannon 08811dde5d Improve the error message for a test that failed on the S-390 Debian buildbot. 2008-03-18 05:43:04 +00:00
Neal Norwitz 819f139c4b Try increasing the timeout to reduce the flakiness of this test. 2008-03-18 05:20:29 +00:00
Jeffrey Yasskin ed414654c4 Speed up test_dict by about 10x by only checking selected dict literal sizes,
instead of every integer from 0 to 400. Exhaustive testing wastes time without
providing enough more assurance that the code is correct.
2008-03-18 05:12:41 +00:00
Jeffrey Yasskin a14585308a Speed test_thread up from 51.328s to 0.081s by reducing its sleep times. We
still sleep at all to make it likely that all threads are active at the same
time.
2008-03-18 04:56:06 +00:00
Jeffrey Yasskin 0bfc896979 Block the "socket.ssl() is deprecated" warning from test_socket_ssl. 2008-03-18 04:29:35 +00:00
Brett Cannon a5573b3153 The output directory for tests that compare against stdout is now gone! 2008-03-18 04:16:06 +00:00
Brett Cannon b7ec8e5a9e test_errno was a no-op test; now it actually tests things and uses unittest. 2008-03-18 03:46:22 +00:00
Brett Cannon 0bb7950829 Move test_extcall to doctest. 2008-03-18 01:58:56 +00:00
Brett Cannon ba17cfc66c Convert test_dummy_threading and test_dbm to unittest. 2008-03-18 01:50:25 +00:00
Brett Cannon 6eeaddc341 Convert test_strftime, test_getargs, and test_pep247 to use unittest. 2008-03-18 01:00:07 +00:00
Eric Smith 0aed07ad80 Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS. 2008-03-17 19:43:40 +00:00
Gregory P. Smith f48f9d38c0 Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.

This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.

Fixes Issue1202 for Python 2.6
2008-03-17 18:48:05 +00:00
Eric Smith 9ff19b5434 Finished backporting PEP 3127, Integer Literal Support and Syntax.
Added 0b and 0o literals to tokenizer.
Modified PyOS_strtoul to support 0b and 0o inputs.
Modified PyLong_FromString to support guessing 0b and 0o inputs.
Renamed test_hexoct.py to test_int_literal.py and added binary tests.
Added upper and lower case 0b, 0O, and 0X tests to test_int_literal.py
2008-03-17 17:32:20 +00:00
Jeffrey Yasskin b9e15f7555 Make isinstance(OldstyleClass, NewstyleClass) return False instead of raising
an exception. Issue reported by Joseph Armbruster.
2008-03-17 16:31:21 +00:00
Eric Smith 8113ca63b9 Issue 2264: empty float presentation type needs to have at least one digit past the decimal point.
Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type.
Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning.
Modified format.__float__ to use the new "Z" format as the default.
Added test cases.
2008-03-17 11:01:01 +00:00
Raymond Hettinger 6b46762974 Removed Exact/Inexact after discussion with Yasskin.
Unlike Scheme where exactness is implemented as taints, the Python
implementation associated exactness with data types.  This created
inheritance issues (making an exact subclass of floats would result
in the subclass having both an explicit Exact registration and an
inherited Inexact registration).  This was a problem for the
decimal module which was designed to span both exact and inexact
arithmetic.  There was also a question of use cases and no examples
were found where ABCs for exactness could be used to improve code.
One other issue was having separate tags for both the affirmative
and negative cases.  This is at odds with the approach taken
elsewhere in the Python (i.e. we don't have an ABC both Hashable
and Unhashable).
2008-03-15 20:02:04 +00:00
Skip Montanaro fc070d2731 add %f format to datetime - issue 1158 2008-03-15 16:04:45 +00:00
Mark Dickinson c23b8a7af9 Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms:  it should now raise OverflowError on all
platforms.  (Previously it raised OverflowError only on
non IEEE 754 platforms.)

Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Brett Cannon 6119540d70 Remove a bad test. 2008-03-14 14:03:10 +00:00
Brett Cannon 1f5182b572 Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
2008-03-13 21:09:28 +00:00
Brett Cannon 4a6e8d669a Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
2008-03-13 21:02:16 +00:00
Brett Cannon 2e0f9f3dd9 Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
2008-03-13 20:47:41 +00:00
Brett Cannon b8d37359cd Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
2008-03-13 20:33:10 +00:00
Brett Cannon 66865d2ebd Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
2008-03-13 20:27:00 +00:00
Raymond Hettinger 53bdf09343 Issue 2274: Add heapq.heappushpop(). 2008-03-13 19:03:51 +00:00
Raymond Hettinger e8b4b60555 Add recipe to docs. 2008-03-11 00:19:07 +00:00
Neal Norwitz 0098c9d609 Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
2008-03-09 19:03:42 +00:00
Jeffrey Yasskin e75f59a578 Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
2008-03-07 06:22:15 +00:00
Raymond Hettinger 38fb9bee6c Tweak recipes and tests 2008-03-07 01:33:20 +00:00
Raymond Hettinger a1ca94a102 Issue 2246: itertools grouper object did not participate in GC (should be backported). 2008-03-06 22:51:36 +00:00
Raymond Hettinger ad47fa141c More tests. 2008-03-06 20:52:01 +00:00
Martin v. Löwis d2bbe526c3 Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
2008-03-06 06:55:22 +00:00
Raymond Hettinger 66f91ea966 C implementation of itertools.permutations(). 2008-03-05 20:59:58 +00:00
Thomas Heller f3c0559b5e Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Jeffrey Yasskin f28896d0bb Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).

Thanks to Trent Nelson for the report and patch.
2008-03-05 06:19:56 +00:00
Neal Norwitz 48309d5a4b Make the timeout longer to give slow machines a chance to pass the test
before timing out.  This doesn't change the duration of the test under
normal circumstances.  This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
2008-03-05 05:38:06 +00:00
Neal Norwitz 218072595e Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson.  (I can't test this.)
2008-03-05 05:14:18 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Raymond Hettinger d553d856e7 Beef-up docs and tests for itertools. Fix-up end-case for product(). 2008-03-04 04:17:08 +00:00
Georg Brandl 26bc177fe6 15 -> 16, the 2nd 2008-03-03 20:39:00 +00:00
Christian Heimes 728bee897f 15 -> 16 2008-03-03 20:30:29 +00:00
Christian Heimes 608c1d8e87 Since abc._Abstract was replaces by a new type flags the regression test suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too? 2008-03-03 18:28:04 +00:00
Brett Cannon 7dbd91811d Add test_main() functions to various tests where it was simple to do. Done so
that regrtest can execute the test_main() directly instead of relying on import
side-effects.
2008-03-03 04:19:29 +00:00
Brett Cannon 963c80fd45 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:26:43 +00:00
Brett Cannon bfbf5b3715 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:24:48 +00:00
Brett Cannon 6382ffc892 Move test_largefile over to using 'with' statements for open files.
Also rename the driver function to test_main() instead of main_test().
2008-03-03 02:41:40 +00:00
Brett Cannon 56c4debe0d Refactor test_logging to use unittest. This should finally solve the flakiness
issues.

Thanks to Antoine Pitrou for the patch.
2008-03-03 00:38:58 +00:00
Gerhard Häring 1cc60ed214 Updated to pysqlite 2.4.1. Documentation additions will come later. 2008-02-29 22:08:41 +00:00
Raymond Hettinger 08ff6822cc Handle the repeat keyword argument for itertools.product(). 2008-02-29 02:21:48 +00:00
Mark Dickinson 1ddf1d8482 Add __format__ method to Decimal, to support PEP 3101 2008-02-29 02:16:37 +00:00
Raymond Hettinger b4cbc98c39 Add alternate constructor for itertools.chain(). 2008-02-28 22:46:41 +00:00
Raymond Hettinger 05bf6338b8 Have itertools.chain() consume its inputs lazily instead of building a tuple of iterators at the outset. 2008-02-28 22:30:42 +00:00
Christian Heimes acfd8ed0cd Windows fix for signal test - skip it earlier 2008-02-28 21:00:45 +00:00
Jeffrey Yasskin 392c159ad6 Prevent SocketServer.ForkingMixIn from waiting on child processes that it
didn't create, in most cases. When there are max_children handlers running, it
will still wait for any child process, not just handler processes.
2008-02-28 18:03:15 +00:00
Jeffrey Yasskin 180997b2bb Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
2008-02-28 05:53:18 +00:00
Jeffrey Yasskin 960b9b7a2f Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed

  ./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'

up from 2.5us to 0.201us. This fixes issue 1762.
2008-02-28 04:45:36 +00:00
Raymond Hettinger 2ab0552b5e Larger test range 2008-02-27 01:08:30 +00:00
Raymond Hettinger 93e804da9c Add itertools.combinations(). 2008-02-26 23:40:50 +00:00
Christian Heimes ea837931cf Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and improve error msg
My tests don't show the promised speed up of 10%. The code is as fast as the old code for simple cases and slightly faster for complex cases with several of args and kwargs. But the patch simplifies the code, too.
2008-02-26 17:23:51 +00:00
Neal Norwitz 75992edfae Speed up this test by about 99%. Remove sleeps and replace with events.
(This may fail on some slow platforms, but we can fix those cases which
should be relatively isolated and easier to find now.)
Move two test cases that didn't require a server to be started
to a separate TestCase.  These tests were taking 3 seconds which
is what the timeout was set to.
2008-02-26 08:04:59 +00:00
Neal Norwitz b0917c14f2 Don't use a hard coded port. This test could hang/fail if the port is in use.
Speed this test up by avoiding a sleep and using the event.
2008-02-26 04:50:37 +00:00
Raymond Hettinger 9d63837e9b Make sure the itertools filter functions give the same performance for func=bool as func=None. 2008-02-25 22:42:32 +00:00
Andrew M. Kuchling aa5e3cea7a Move .setupterm() output so that we don't try to call endwin() if it fails 2008-02-25 16:29:19 +00:00
Brett Cannon c6b5200931 Fix a minor typo in a docstring. 2008-02-25 05:33:33 +00:00
Neal Norwitz 6057b2e645 Create a db_home directory with a unique name so multiple users can
run the test simultaneously.  The simplest thing I found that worked
on both Windows and Unix was to use the PID.  It's unique so should be
sufficient.  This should prevent many of the spurious failures of
the automated tests since they run as different users.

Also cleanup the directory consistenly in the tearDown methods.

It would be nice if someone ensured that the directories are always
created with a consistent name.
2008-02-24 18:47:03 +00:00
Facundo Batista c11cecf3d0 Issue 1742669. Now %d accepts very big float numbers.
Thanks Gabriel Genellina.
2008-02-24 03:17:21 +00:00
Georg Brandl 8c460d5241 #1627: httplib now ignores negative Content-Length headers. 2008-02-24 00:14:24 +00:00
Georg Brandl 2363503074 #900744: If an invalid chunked-encoding header is sent by a server,
httplib will now raise IncompleteRead and close the connection instead
of raising ValueError.
2008-02-24 00:03:22 +00:00
Georg Brandl ebcfd11c16 #1506171: added operator.methodcaller(). 2008-02-23 23:04:35 +00:00
Georg Brandl e2065c65d3 #1826: allow dotted attribute paths in operator.attrgetter. 2008-02-23 23:02:23 +00:00
Facundo Batista c12b9888f7 Added simple test case. Thanks Benjamin Peterson. 2008-02-23 22:54:12 +00:00
Georg Brandl 0bb8567e1e 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.
2008-02-23 22:35:33 +00:00
Jeffrey Yasskin a885c1521a Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
2008-02-23 20:40:35 +00:00
Jeffrey Yasskin 3414ea9ed9 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.
2008-02-23 19:40:54 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Andrew M. Kuchling 19aff0c90a #1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert
2008-02-23 17:10:46 +00:00
Andrew M. Kuchling 085f75a851 #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
Remove automatic handling of datetime.date and datetime.time.
This breaks backward compatibility, but python-dev discussion was strongly
against this automatic conversion; see the bug for a link.
2008-02-23 16:23:05 +00:00
Georg Brandl ad61bc8d9b #2067: file.__exit__() now calls subclasses' close() method. 2008-02-23 15:11:18 +00:00
Facundo Batista 7e251e83d5 Issue 1089358. Adds the siginterrupt() function, that is just a
wrapper around the system call with the same name.  Also added
test cases, doc changes and NEWS entry. Thanks Jason and Ralf
Schmitt.
2008-02-23 15:07:35 +00:00
Georg Brandl 57826cf9f8 #2165: fix test_logging failure on some machines. 2008-02-23 15:06:25 +00:00
Christian Heimes 5224d28d38 Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
2008-02-23 15:01:05 +00:00
Facundo Batista b12f0b581a Issue 1781. Now ConfigParser.add_section does not let you add a
DEFAULT section any more, because it duplicated sections with
the rest of the machinery. Thanks Tim Lesher and Manuel Kaufmann.
2008-02-23 12:46:10 +00:00
Facundo Batista 1660933d23 Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
2008-02-23 12:27:17 +00:00
Facundo Batista fc2d01032f Issue 1881. Increased the stack limit from 500 to 1500. Also added
a test for this (and because of this test you'll see in stderr a
message that parser.c sends before raising MemoryError).
Thanks Ralf Schmitt.
2008-02-23 12:01:13 +00:00
Eric Smith a73fbe791d Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct(). 2008-02-23 03:09:44 +00:00
Raymond Hettinger 73d7963242 Improve the implementation of itertools.product()
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Eric Smith fb0742fe4f Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin. 2008-02-22 17:43:17 +00:00
Raymond Hettinger 50986cc45b First draft for itertools.product(). Docs and other updates forthcoming. 2008-02-22 03:16:42 +00:00
Eric Smith ce584d420d Moved test_format into the correct TestCase. 2008-02-21 20:17:08 +00:00
Eric Smith 7ef40bf9c7 Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description). 2008-02-20 23:34:22 +00:00
Eric Smith bc32fee029 Added code to correct combining str and unicode in ''.format(). Added test case. 2008-02-18 18:02:34 +00:00
Eric Smith d50a5f2845 Temporarily removed float tests. See issue 1600. 2008-02-18 14:25:02 +00:00
Facundo Batista d14600ec94 Issue 1224. Now we support again the double slash in the URL.
Thanks Anthony Lenton.
2008-02-18 12:48:43 +00:00
Facundo Batista 759bfc6207 Issue #1916. Added isgenerator() and isgeneratorfunction() to
inspect.py.  Thanks Javi Mansilla for patch review and
corrections.
2008-02-18 03:43:43 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
Highlights:
 - Adding PyObject_Format.
 - Adding string.Format class.
 - Adding __format__ for str, unicode, int, long, float, datetime.
 - Adding builtin format.
 - Adding ''.format and u''.format.
 - str/unicode fixups for formatters.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
2008-02-17 19:46:49 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Brett Cannon f9db8a3a20 Move test_logging over to doctest.
Thanks to Christopher White from GHOP.
2008-02-17 01:59:18 +00:00
Amaury Forgeot d'Arc 632fad3933 Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
2008-02-16 20:55:24 +00:00
Amaury Forgeot d'Arc 64d6843788 mmap.PROT_READ does not exists on win32;
Skip this test created by r60830.
2008-02-16 00:16:50 +00:00
Amaury Forgeot d'Arc d8bcbf2b2e Re-enable tests, they were failing since gc.collect() clears the various freelists.
They still remain fragile.

For example, a call to assertEqual currently does not make any allocation
(which surprised me at first).
But this can change when gc.collect also deletes the numerous "zombie frames"
attached to each function.
2008-02-15 22:44:20 +00:00
Amaury Forgeot d'Arc f67abccf64 Temporarily let these tests pass 2008-02-15 21:27:44 +00:00
Amaury Forgeot d'Arc 60d6c7f0cc Issue #2115: __slot__ attributes setting was 10x slower.
Also correct a possible crash using ABCs.

This change is exactly the same as an optimisation
done 5 years ago, but on slot *access*:
http://svn.python.org/view?view=rev&rev=28297
2008-02-15 21:22:45 +00:00
Christian Heimes 7adfad850a Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
2008-02-15 08:20:11 +00:00
Christian Heimes 2f0da53d28 Fixed repr() and str() of complex numbers. Complex suffered from the same problem as floats but I forgot to test and fix them. 2008-02-15 06:57:08 +00:00
Jeffrey Yasskin 1c214d6c94 Performance optimizations on Fraction's constructor.
./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3)`
31.7 usec/loop -> 9.2 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3, 2)'`
27.7 usec/loop -> 9.32 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction; f = Fraction(3, 2)' 'Fraction(f)'
31.9 usec/loop -> 14.3 usec/loop
2008-02-14 06:12:24 +00:00
Raymond Hettinger abe3237187 Fix decimal repr which should have used single quotes like other reprs. 2008-02-14 02:41:22 +00:00
Jeffrey Yasskin 57bd60b465 Working on issue #1762: Brought
./python.exe -m timeit -s 'from fractions import Fraction; f = Fraction(3, 2)' 'isinstance(3, Fraction); isinstance(f, Fraction)'
from 12.3 usec/loop to 3.44 usec/loop and
  ./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3, 2)'
from 48.8 usec to 23.6 usec by avoiding genexps and sets in __instancecheck__
and inlining the common case from __subclasscheck__.
2008-02-13 17:58:04 +00:00
Mark Dickinson 5f8bd3729e Replace R=fractions.Fraction with F=fractions.Fraction in
test_fractions.py.  This should have been part of the name
change from Rational to Fraction.
2008-02-12 21:46:54 +00:00
Mark Dickinson e1b824793a Implementation of Fraction.limit_denominator.
Remove Fraction.to_continued_fraction and
Fraction.from_continued_fraction
2008-02-12 21:31:59 +00:00
Raymond Hettinger 21290eacf6 Add tests for pickletools.optimize(). 2008-02-11 20:05:53 +00:00
Lars Gustäbel 6bf51da9d4 Make sure that xstar headers are read correctly. 2008-02-11 19:17:10 +00:00
Mark Dickinson cd873fc142 Put an extra space into the repr of a Fraction:
Fraction(1, 2) instead of Fraction(1,2).
2008-02-11 03:11:55 +00:00
Christian Heimes 03d3abf375 The test requires the network resource 2008-02-11 02:26:22 +00:00
Mark Dickinson d058cd2cc8 Rename rational.Rational to fractions.Fraction, to avoid name clash
with numbers.Rational.  See issue #1682 for related discussion.
2008-02-10 21:29:51 +00:00
Skip Montanaro a5a9a733c8 whoops - revert 2008-02-10 15:32:16 +00:00
Skip Montanaro c376f20d76 Get the saying right. ;-) 2008-02-10 15:31:54 +00:00
Nick Coghlan 97fac3eb0a Issue 2021: Allow NamedTemporaryFile and SpooledTemporaryFile to be used as context managers. (The NamedTemporaryFile fix should be considered for backporting to 2.5) 2008-02-09 15:28:09 +00:00
Raymond Hettinger 8c6c12ca96 Temporarily disable this test. It's been broken for a week. 2008-02-09 10:06:20 +00:00
Hye-Shik Chang 01612e7dec Update big5hkscs codec to conform to the HKSCS:2004 revision. 2008-02-08 17:10:20 +00:00
Jeffrey Yasskin 27d339446a Oops! 2.6's Rational.__ne__ didn't work. 2008-02-08 06:45:40 +00:00
Amaury Forgeot d'Arc b01aa430d5 issue 2045: Infinite recursion when printing a subclass of defaultdict,
if default_factory is set to a bound method.

Will backport.
2008-02-08 00:56:02 +00:00
Facundo Batista 86371d61b7 Fixes Issue 1401. When redirected, a possible POST get converted
to GET, so it loses its payload. So, it also must lose the
headers related to the payload (if it has no content any more,
it shouldn't indicate content length and type).
2008-02-07 19:06:52 +00:00
Facundo Batista 9521f08b98 Fixes issue 2026. Tests converted to unittest. Thanks
Giampaolo Rodola.
2008-02-07 16:16:29 +00:00
Andrew M. Kuchling 8d119301a1 Update URL 2008-02-07 11:43:47 +00:00
Raymond Hettinger 882a416900 Merge r60628, r60631, and r60633. Register UserList and UserString will the appropriate ABCs. 2008-02-07 03:25:46 +00:00
Raymond Hettinger 5b07ebce86 Issue 2025: Add tuple.count() and tuple.index() to follow the ABC in collections.Sequence. 2008-02-07 00:54:20 +00:00
Georg Brandl 3c3d9ac46c Revert accidental changes to test_queue in r60605. 2008-02-06 23:45:51 +00:00
Mark Dickinson 2fc9263df5 Issue 1979: Make Decimal comparisons (other than !=, ==) involving NaN
raise InvalidOperation (and return False if InvalidOperation is trapped).
2008-02-06 22:10:50 +00:00
Facundo Batista 5af2f7454d Fixes issue 1959. Converted tests to unittest.
Thanks Giampaolo Rodola.
2008-02-06 19:28:49 +00:00
Georg Brandl b70907796a * Use the same code to profile for test_profile and test_cprofile.
* Convert both to unittest.
* Use the same unit testing code.
* Include the expected output in both test files.
* Make it possible to regenerate the expected output by running
  the file as a script with an '-r' argument.
2008-02-05 19:58:17 +00:00
Georg Brandl d86c7e5d93 Actually run the test. 2008-02-05 19:07:10 +00:00
Facundo Batista c2879c70e4 Issue 1951. Converts wave test cases to unittest. 2008-02-05 19:03:32 +00:00
Georg Brandl 8ada17742b Fix unittest conversion breakage. 2008-02-05 18:32:47 +00:00
Amaury Forgeot d'Arc 99af7dbc07 Change r60575 broke test_compile:
there is no need to emit co_lnotab item when both offsets are zeros.
2008-02-05 00:26:21 +00:00
Amaury Forgeot d'Arc 6fd03bb607 #1750076: Debugger did not step on every iteration of a while statement.
The mapping between bytecode offsets and source lines (lnotab) did not contain
an entry for the beginning of the loop.

Now it does, and the lnotab can be a bit larger:
in particular, several statements on the same line generate several entries.
However, this does not bother the settrace function, which will trigger only
one 'line' event.

The lnotab seems to be exactly the same as with python2.4.
2008-02-04 21:45:05 +00:00
Christian Heimes f5806ab6e3 Small adjustments for test compact freelist test. It's no passing on Windows as well. 2008-02-04 19:30:05 +00:00
Christian Heimes f4033ab245 Increase debugging to investige failing tests on some build bots 2008-02-04 18:48:38 +00:00
Christian Heimes 422051a367 Patch #1953
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers.
The patch also renames sys._cleartypecache to sys._clear_type_cache
2008-02-04 18:00:12 +00:00
Jeffrey Yasskin a26cf9b760 Make int() and long() fall back to __trunc__(). See issue 2002. 2008-02-04 01:04:35 +00:00
Amaury Forgeot d'Arc 72a6576279 Let test_socketserver pass on win32, which does not have AF_UNIX sockets. 2008-02-03 23:57:24 +00:00
Amaury Forgeot d'Arc 07974d7a93 Correct test_mailbox on win32: since the test sets a custom 'colon' attribute
to the main mailbox, copy it to secondary mailbox instances.
2008-02-03 23:15:32 +00:00
Brett Cannon 4b7deed9a5 Use context manager for a lock. 2008-02-03 02:43:01 +00:00
Georg Brandl 461ed872e2 Wait for a delay before reaping children -- this should fix the
test_socketserver failures on several platforms.
2008-02-03 00:04:50 +00:00
Georg Brandl cafb710711 Fix a conversion mistake that caused test_queue to fail intermittently. 2008-02-02 23:59:21 +00:00
Mark Dickinson 1dabdb25f8 Make the Rational constructor accept '3.' and '.2' as well as '3.2'. 2008-02-02 17:16:13 +00:00
Georg Brandl 5a6cfee632 Rewrite test_cprofile as unittest (and rename the file to be consistent
with all other test files). Written for GHOP by Benjamin Peterson.
2008-02-02 11:46:07 +00:00
Georg Brandl d22b4661fd Rewrite test_queue as unittest. Written for GHOP by Ian Seyer. 2008-02-02 11:39:29 +00:00
Georg Brandl 61fdd71ad4 Rewrite test_socketserver as unittest, written for GHOP by Benjamin Petersen. 2008-02-02 11:05:00 +00:00
Georg Brandl c8088df363 Rewrite test_funcattrs as unittest, written for GHOP by Jeff Wheeler. 2008-02-02 10:18:15 +00:00
Georg Brandl 4854552f02 Rewrite test_descr as unittest, written for GHOP by Jeff Wheeler. 2008-02-02 10:12:36 +00:00
Raymond Hettinger 4cab8ece0a Test round-trip on float.as_integer_ratio() and float.__truediv__(). 2008-02-01 22:42:59 +00:00
Raymond Hettinger 04c96d52a4 Issue #1996: float.as_integer_ratio() should return fraction in lowest terms. 2008-02-01 21:30:23 +00:00
Jeffrey Yasskin dc2964b0d8 Roll back r60248. It's useful to encourage users not to change Rational
instances.
2008-02-01 07:05:46 +00:00
Jeffrey Yasskin ca2b69f765 Move __builtins__.trunc() to math.trunc() per
http://mail.python.org/pipermail/python-dev/2008-January/076626.html and issue
1965.
2008-02-01 06:22:46 +00:00
Mark Dickinson 105be7725b Issue #1678380. Fix a bug that identifies 0j and -0j when they appear
in the same code unit. The fix is essentially the same as the fix for a
previous bug identifying 0. and -0.
2008-01-31 22:17:37 +00:00
Jeffrey Yasskin 38db364076 Remove unused to-be-magic methods from Rational per issue 1968. Do not port
this patch to py3k.
2008-01-31 17:45:59 +00:00
Christian Heimes 908caac52e Added clear cache methods to clear the internal type lookup cache for ref leak test runs. 2008-01-27 23:34:59 +00:00
Jeffrey Yasskin 3ea7b41b58 Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() because
it's useful outside of rational numbers.

This is my first C code that had to do anything significant. Please be more
careful when looking over it.
2008-01-27 23:08:46 +00:00
Neal Norwitz cf25eb14af socket.error doesn't have a headers attribute like ProtocolError.
Handle that situation where we catch socket.errors.
2008-01-27 20:03:13 +00:00
Neal Norwitz ed444e52da Try to handle socket.errors properly in is_unavailable 2008-01-27 18:19:04 +00:00
Neal Norwitz c5198090f3 Update the comment and remove the close. If we close we can't flush anymore.
We might still need to close after the for loop if flushing 6! times still
doesn't cause the signal/exception.
2008-01-27 18:09:48 +00:00
Neal Norwitz 41ada16cb7 Print periodic "still working" messages since this suite is slow. 2008-01-27 17:13:07 +00:00
Neal Norwitz 183c5346fe Catch socket errors that are often the cause of transient failures.
Many of these exceptions are due to resource unavailable, so the
existing code should be able to handle many more spurious errors.
2008-01-27 17:11:11 +00:00
Neal Norwitz 9846de1dfb Retry connection in case it fails to reduce flakiness 2008-01-27 17:10:58 +00:00
Neal Norwitz 041ee5d373 Add a tiny sleep and additional flush to force the file to really be synced. 2008-01-27 17:10:50 +00:00
Jeffrey Yasskin 3e1a373616 Make rational.gcd() public and allow Rational to take decimal strings, per
Raymond's advice.
2008-01-27 05:40:35 +00:00
Neal Norwitz 46c61b2c1d Try to prevent this test from being flaky. We might need a sleep in here
which isn't as bad as it sounds.  The close() *should* raise an exception,
so if it didn't we should give more time to sync and really raise it.

Will backport.
2008-01-27 05:02:34 +00:00
Neal Norwitz 6e070814b2 Eliminate the sleeps that assume the server will start in .5 seconds.
This should make the test less flaky.  It also speeds up the test
by about 75% on my box (20+ seconds -> ~4 seconds).
2008-01-27 01:44:05 +00:00
Neal Norwitz 7f47d93f52 On some systems (e.g., Ubuntu on hppa) the flush()
doesn't cause the exception, but the close() does.

Will backport.
2008-01-26 23:13:46 +00:00
Neal Norwitz 37184295dc Reduce the race condition by signalling when the server is ready
and not trying to connect before.
2008-01-26 21:21:59 +00:00
Neal Norwitz a121508fac Always try to remove the test file even if close raises an exception 2008-01-26 21:02:45 +00:00
Christian Heimes a2af21262a Unit test fix from Giampaolo Rodola, #1938 2008-01-26 16:43:35 +00:00
Georg Brandl 0cdf9a36ec #1473257: add generator.gi_code attribute that refers to
the original code object backing the generator. Patch by Collin Winter.
2008-01-26 14:14:20 +00:00
Neal Norwitz 08b50eb3d3 The OS X buildbot had errors with the unavailable exceptions disabled. Restore it. 2008-01-26 08:26:00 +00:00