Commit Graph

1330 Commits

Author SHA1 Message Date
Finn Bock 84cc9bf722 Committing and closing SF patch #441348 to help Jython to pass this test. 2001-08-23 18:57:01 +00:00
Guido van Rossum 83b120d690 Turn OverflowWarning into an error locally, in order to make the
OverflowError test succeed.
2001-08-23 03:23:03 +00:00
Barry Warsaw 60f018846d Merge changes from r22a2-branch back into trunk. Also, change patch
level to 2.2a2+
2001-08-22 19:24:42 +00:00
Barry Warsaw d1ed15edb3 A test of SSL support, using a roundabout method suggested by Guido.
However, this is only enabled with regrtest's --use=network switch.
2001-08-20 22:39:42 +00:00
Barry Warsaw 7fdfc3885c Use test_support.requires() to decide whether additional largefile
tests should be run.
2001-08-20 22:37:34 +00:00
Barry Warsaw 08fca52125 Removed --have-resources flag in favor of the more granular -u/--use
flag, which specifies external or resource intensive tests to
perform.  This is used by test_largefile and test_socket_ssl.

-u/--use takes a comma separated list of flags, currently supported:
largefile, network.

usage(): New function.  Note that the semantics of main() have changed
    slightly; instead of returning an error code, it raises a
    SystemExit (via sys.exit()) with the given error code.

main(): use_large_resources => use_resources
    Also, added support for long-option alternative to the short
    options.

_expectations: Added test_socket_ssl to the list of expectedly skipped
    tests.
2001-08-20 22:33:46 +00:00
Barry Warsaw c0fb605ce3 use_large_resources => use_resources
requires(): New function which can be used to `assert' that a specific
    -u/--use resource flag is present.  Raises a TestSkipped if not.
    This is used in test_largefile and test_socket_ssl to enable
    external or resource consumptive tests that are normally
    disabled.
2001-08-20 22:29:23 +00:00
Tim Peters 02035bc68d Test failed because these was no expected-output file, but always printed
to stdout.  Repaired by not printing at all except in verbose mode.

Made the test about 6x faster -- envelope analysis showed it took time
proportional to the square of the # of tasks.  Now it's linear.
2001-08-20 21:45:19 +00:00
Fred Drake 029acfb922 Deal more appropriately with bare ampersands and pointy brackets; this
module has to deal with "class" HTML-as-deployed as well as XHTML, so we
cannot be as strict as XHTML allows.

This closes SF bug #453059, but uses a different fix than suggested in
the bug comments.
2001-08-20 21:24:19 +00:00
Jeremy Hylton 18da1e1e7f Add test case to cover multiple future statements on separate lines of
a module.
2001-08-20 21:18:56 +00:00
Jeremy Hylton 8471a35feb Fix SF bug [ #450245 ] Error in parsing future stmts
Add test case to cover multiple future statements on separate lines of
a module.
2001-08-20 20:33:42 +00:00
Barry Warsaw 07d8d6415f Committing and closing SF patch #403671 by Finn Bock to help Jython
pass these tests.
2001-08-20 20:29:07 +00:00
Skip Montanaro 4533f60da5 add a few test cases for threading module. 2001-08-20 20:28:48 +00:00
Jeremy Hylton a7fc21baf6 Silence warnings during test_os 2001-08-20 20:10:01 +00:00
Tim Peters aa32070f4d Expose the CO_xxx flags via the "new" module (re-solving a problem "the
right way").  Fiddle __future__.py to use them.

Jeremy's pyassem.py may also want to use them (by-hand duplication of
magic numbers is brittle), but leaving that to his judgment.

Beef up __future__'s test to verify the exported feature names appear
correct.
2001-08-18 20:18:49 +00:00
Tim Peters 9fa96bed6f Fix for bug [#452230] future division isn't propagated.
builtin_eval wasn't merging in the compiler flags from the current frame;
I suppose we never noticed this before because future division is the
first future-feature that can affect expressions (nested_scopes and
generators had only statement-level effects).
2001-08-17 23:04:59 +00:00
Martin v. Löwis 10d7255249 Use raw-unicode-escape for the tests that require it. 2001-08-17 22:08:34 +00:00
Guido van Rossum 65d5d7fac6 Add test for weak references. 2001-08-17 21:27:53 +00:00
Barry Warsaw d1795705de Test that uu.py will not override an existing file if out_file isn't
given and the path is gleaned from the uu header.
2001-08-17 20:00:11 +00:00
Tim Peters de642bdc5d A self-contained piece of Michael Hudson's patch
#449043 supporting __future__ in simulated shells
in support of PEP 264.

Much has changed from the patch version:
+ Repaired bad hex constant for nested_scopes.
+ Defined symbolic CO_xxx names so global search will find these uses.
+ Made the exported list of feature names explicit, instead of abusing
  __all__ for this purpose (and redefined __all__ accordingly).
+ Added gross .compiler_flag verification to test___future__.py, and
  reworked it a little to make use of the newly exported explicit list
  of feature names.
2001-08-17 19:49:02 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +00:00
Guido van Rossum 84a79a8d25 classic(),metods(): add tests to verify that a bound method without a
class has a correct repr().
2001-08-17 13:58:31 +00:00
Guido van Rossum 93018760bc classic(), methods(): add another test relating to unbound methods:
when an unbound method of class A is stored as a class variable of
class B, and class B is *not* a subclass of class A, that method
should *not* get bound to B instances.
2001-08-17 13:40:47 +00:00
Guido van Rossum 7e1ff69271 Add early binding of methods to the 2nd metaclass example. 2001-08-17 11:55:58 +00:00
Guido van Rossum 309b566704 metaclass(): add tests for metaclasses written in Python: one that
subclasses type, one that doesn't (the latter isn't fully functional
yet).
2001-08-17 11:43:17 +00:00
Barry Warsaw f6365e0107 Added a test for module repr truncation when the package name is
really long.  Closes SF bug #437984.
2001-08-16 20:42:38 +00:00
Guido van Rossum 501c7c7d0e classobject.c:instancemethod_descr_get(): when a bound method is
assigned to a class variable and then accessed via an instance, it
should not be rebound.

test_descr.py:methods(): test for the condition above.
2001-08-16 20:41:56 +00:00
Tim Peters 4d2dded044 test_descr started breaking in yet another way in the same place. 2001-08-16 19:50:51 +00:00
Fred Drake 3791838339 New unit test for the mimetypes module, to avoid future regressions. 2001-08-16 18:36:59 +00:00
Tim Peters 63a8d69476 Repair some accidents causing Windows failures:
+ test_compare.  While None compares less than anything else, it's not
  always the case that None has the smallest id().
+ test_descr.  The output of %p (pointer) formats varies across platforms.
  In particular, on Windows it doesn't produce a leading "0x".
2001-08-16 16:56:16 +00:00
Guido van Rossum 297abadc6b The change of type(None).__name__ from 'None' to 'NoneType' broke this
test in a trivial way.  Fixed.
2001-08-16 08:32:39 +00:00
Guido van Rossum a4ff6ab093 Add tests for overridable operators that have default interpretations
(__hash__ etc.), in static and dynamic classes, overridden and
default.
2001-08-15 23:57:59 +00:00
Guido van Rossum 28962cc0ea Given a class without __cmp__ or __eq__, cmp() of two instances of
that class should compare the id() of those instances.  Add a test
that verifies this.  This test currently fails; I believe this is
caused by object.c:2.132 (Patch #424475 by loewis).
2001-08-15 21:02:20 +00:00
Guido van Rossum b5a136b05d Add a test to verify that bound methods work correctly. 2001-08-15 17:51:17 +00:00
Tim Peters e5614630fb Move one of the tests into the "PEP 255" section, to reflect a change in
the PEP.
2001-08-15 04:41:19 +00:00
Guido van Rossum 80e36750c8 Add a test for a weird bug I just discovered: a dynamic subclass
doesn't have a __dict__!
2001-08-14 20:00:33 +00:00
Barry Warsaw 033daa49ea Test the new semantics for setting and deleting a function's __dict__
attribute.  Deleting it, or setting it to a non-dictionary result in a
TypeError.  Note that getting it the first time magically initializes
it to an empty dict so that func.__dict__ will always appear to be a
dictionary (never None).

Closes SF bug #446645.
2001-08-14 18:28:28 +00:00
Barry Warsaw b9c1d3dedf reload(exceptions) should not raise an ImportError, but should act
just like reload(sys).  Test that this is so.  Closes SF bug #422004.
2001-08-13 23:07:00 +00:00
Tim Peters 04601063e8 Repair Unix-specific assumptions that caused this to fail on Windows. 2001-08-13 22:25:24 +00:00
Fred Drake 3a28ca8fb8 Nick Mathewson: test suite for the class browser support module. 2001-08-13 20:26:19 +00:00
Jeremy Hylton 39f77bc90e Modify _Set to support iteration.
Otherwise printlist(surprise) will fail with a TypeError, because map
is called with an argument that doesn't support iteration.
2001-08-12 21:53:08 +00:00
Guido van Rossum d3077402c7 - Expand test for dynamic objects.
- Remove various 'global' directives and move some global definitions
  inside the test functions that use them -- we have nested scopes so
  the old hacks using globals are no longer needed.
2001-08-12 05:24:18 +00:00
Tim Peters a45da92484 Make the output of tests skipped readable (i.e., deliberately break it
into indented lines each of which probably fits on a typical screen line).
2001-08-12 03:45:50 +00:00
Guido van Rossum 9d4fe4298e dynamics(): add tests for dynamic *instances* (which are currently
broken).  Also fix an invalid reference to C (should be S).
2001-08-12 03:38:18 +00:00
Jeremy Hylton 08a6403973 Test the unary operator changes to the compiler 2001-08-12 02:22:27 +00:00
Guido van Rossum f73e30c3e3 Add the list of expected skips for Linux 2.x. Restructured the code a
little bit using a dictionary to avoid more code duplication as
more platforms are supported.
2001-08-12 02:22:19 +00:00
Tim Peters a2be2d624a Move line; reported on python-dev by Mark Favas (thanks!). 2001-08-12 02:01:09 +00:00
Tim Peters b5b7b78414 Teach regrtest which tests we *expect* to skip on Win32. Please teach it
about your platform too.
2001-08-12 01:20:39 +00:00
Jack Jansen dbc363ce35 The test assumed that the local pathname convention for "foo" would sort before "foo/bar", which is not true on the mac (where they are "foo" and ":foo:bar", respectively; ":foo" would be fine too, but "foo" is the preferred spelling). Fixed by sorting the output. 2001-08-11 23:22:43 +00:00
Fred Drake cd112f5546 Added tests for rich comparison operator functions.
Converted tests to PyUnit.
2001-08-11 03:21:35 +00:00
Guido van Rossum e45763a8e6 Add test for SF bug #442833 (multiple inheritance). 2001-08-10 21:28:46 +00:00
Guido van Rossum 61cf780b6d The message accompanying the TypeError exception on a readonly
attribute changed again.
2001-08-10 21:25:24 +00:00
Guido van Rossum 6d94627f1e Allow AttributeError as well as TypeError for attribute-less objects. 2001-08-10 19:42:38 +00:00
Andrew M. Kuchling fcfc8d5c0e Patch #441091 from Finn Bock: the more advanced flush options are not
available in java, so only use the advanced flush options if they
  are defined in the zlib module.
2001-08-10 15:50:11 +00:00
Guido van Rossum e056e4d15c Check in a testcase for SF bug #449000: re.sub(r'\n', ...) broke. 2001-08-10 14:52:48 +00:00
Tim Peters ab9ba27dc0 Whitespace normalization. 2001-08-09 21:40:30 +00:00
Tim Peters c7ca3ffba3 Skip test_mhlib on Windows -- too many Unix assumptions. 2001-08-09 21:34:54 +00:00
Fred Drake eaa77e2ca1 Added tests for operator.floordiv() and operator.truediv(). 2001-08-09 20:23:08 +00:00
Guido van Rossum 3720261729 Restore the test for 'object' that I removed when object was
uninstantiable.  All is well now.
2001-08-09 19:45:21 +00:00
Guido van Rossum 0263c80b90 Unittests for mhlib, by Nick Mathewson. 2001-08-09 18:18:08 +00:00
Martin v. Löwis 8cc965c1fb Patch #448474: Add support for tell() and seek() to gzip.GzipFile. 2001-08-09 07:21:56 +00:00
Guido van Rossum 64deef2b17 A test suite for binary operators, disguised as a rational number
class.
2001-08-08 22:27:20 +00:00
Fred Drake c9fadf991c Add a test that xml.sax.saxutils.XMLGenerator does the right thing
when quoting attribute values that contain single & double quotes.

This provides the rest of the regression test for SF bug #440351.
2001-08-07 19:17:06 +00:00
Guido van Rossum 288cd2cb69 Fix the test so it uses IterableUserDict for the "for x in dict" test. 2001-08-07 17:50:06 +00:00
Guido van Rossum 15d86c6297 Remove the test for the 'object' type -- it can no longer be
instantiated.  (Its use as a base class is adequately tested by other
tests.)
2001-08-07 16:53:42 +00:00
Jeremy Hylton cd738364ce silence warnings about import * 2001-08-07 16:38:19 +00:00
Greg Ward cbce202f82 Hack to workaround bug #445984: attempt to import _socket before
starting the test suite proper.  If _socket fails to build, that will
make this test fail with an ImportError -- handled by the test harness
as "no such module _socket" -- instead of an AttributeError deep in
CGIHTTPServer.
2001-08-04 22:22:19 +00:00
Tim Peters c173137391 Derived from SF patch #446899 Permit import of .pyw under Windows, from
David Bolen.
2001-08-04 08:12:36 +00:00
Tim Peters e861365dab Don't use any characters C doesn't guarantee are safe for text-mode files.
This should stop the bizarre translations Jack was getting from Mac CVS.
2001-08-03 20:40:18 +00:00
Fred Drake 84bb9d8dc4 Fix stupid bug: when migrating these tests from the Zope repository, the
names of the test methods were not changed from the Zope-standard "check"
names to the Python-standard "test_" names, so the tests were not actually
being run.

Added test of hexadecimal character references as a regression check for
SF bug #445196.
2001-08-03 19:53:01 +00:00
Jack Jansen fffd7224df The test opened the binary test data files in text mode! Fixed. 2001-08-03 13:04:03 +00:00
Fred Drake 4fd06e0170 Make sure that WeakValueDictionary[] raises KeyError instead of TypeError
for keys that are not in the dictionary.
2001-08-03 04:11:27 +00:00
Tim Peters d342c62961 This test failed under python -O.
rewrite_file():  Delete both .pyc and .pyo leftovers, and explicitly close
the new source file after writing to it.
2001-08-02 17:23:11 +00:00
Guido van Rossum 394a47b268 Unit test for improved package import semantics.
Original by Alex Coventry (in SF patch #441791), adapted to the
standard regression test framework.
2001-08-02 14:14:20 +00:00
Tim Peters 6d6c1a35e0 Merge of descr-branch back into trunk. 2001-08-02 04:15:00 +00:00
Tim Peters 722d78f18a s/endswith/startswith/ 2001-08-01 20:23:18 +00:00
Tim Peters 66e1a254a1 Rewritten version of Finn Bock's SF patch #446907 (Allow jython to
complete test_import).
2001-08-01 19:38:56 +00:00
Tim Peters 108efac24e test_codeup should not have had an expected-output file; removing it. 2001-07-30 23:10:44 +00:00
Jeremy Hylton b7a7731e01 Add tests for getattr() and hasattr() with non-string args 2001-07-30 22:49:11 +00:00
Jeremy Hylton 5121e7de11 Fix for SF bug [ #443866 ] Evaluating func_code causing core dump
Add test that calls eval with a code object that has free variables.
2001-07-30 21:55:29 +00:00
Jeremy Hylton 3c19ec4eab Fix when pyexpat not built
Import pyexpat first so that import error occurs when it is not
available.
2001-07-30 21:47:25 +00:00
Martin v. Löwis 3bd071e3f7 Patch #442866: Tests for codeop.py. 2001-07-30 12:30:08 +00:00
Tim Peters 33dc0a1705 One more crack at join(): stop trying to pretend this isn't a mass of
special cases.  test_pkg works again on Windows.
2001-07-27 08:09:54 +00:00
Tim Peters 4223f89edd Change ntpath.join() so that join("d:/", "/whatever") returns
d:/whatever instead of /whatever.  While I'm afraid changing isabs()
to be *consistent* with this would break lots of code, it makes
best sense for join() to do it this way.  Thanks to Alex Martelli for
pushing back on this one!
2001-07-26 21:54:37 +00:00
Tim Peters 7321ec437b SF bug #444510: int() should guarantee truncation.
It's guaranteed now, assuming the platform modf() works correctly.
2001-07-26 20:02:17 +00:00
Marc-André Lemburg 80d1dd5f3b Fix for bug #444493: u'\U00010001' segfaults with current CVS on
wide builds.
2001-07-25 16:05:59 +00:00
Fred Drake f973c6d594 Make this test work under Windows as well. 2001-07-23 16:30:21 +00:00
Fred Drake 99e87f9e23 Test for the "glob" module, contributed by Nick Mathewson.
Heavily modified so this doesn't break on Windows.
This closes SF patch #441175.
2001-07-23 16:08:36 +00:00
Tim Peters fa712ca1ed Whitespace normalization.
Note:  This test fails on Windows.  Don't know why yet.
2001-07-23 09:44:21 +00:00
Fred Drake 4c81d60fcb Tests for the "commands" module, contributed by Nick Mathewson.
This closes SF patch #440291.
2001-07-23 04:08:01 +00:00
Fred Drake 1586136193 New tests by Nick Mathewson, for the fpformat module.
This closes SF patch #440290.
2001-07-23 02:46:35 +00:00
Tim Peters 137759407b On WIndows, skip the part of test_dircache that can't work on Windows. 2001-07-21 02:22:14 +00:00
Tim Peters 87cc0c329e Whitespace normalization, plus:
+ test_quopri.py relied on significant trailing spaces.  Fixed.
+ test_dircache.py (still) doesn't work on Windows (directory mtime on
  Windows doesn't work like it does on Unix).
2001-07-21 01:41:30 +00:00
Fred Drake 79e75e1916 Use string.ascii_letters instead of string.letters (SF bug #226706). 2001-07-20 19:05:50 +00:00
Marc-André Lemburg 6c6bfb7c70 Make the unicode-escape and the UTF-16 codecs handle surrogates
correctly and thus roundtrip-safe.

Some minor cleanups of the code.

Added tests for the roundtrip-safety.
2001-07-20 17:39:11 +00:00
Fred Drake 84073bfdb0 Regression test for the dircache module, contributed by Nick Mathewson.
Modified by Fred Drake.
This closes SF patch #440827.
2001-07-19 22:59:09 +00:00
Fred Drake 8e6669ad05 Test for the repr module, contributed by Nick Mathewson.
This closes SF patch #440826.
2001-07-19 22:27:56 +00:00
Tim Peters d4f7f609bf Add some test cases for ntpath.join(). 2001-07-19 19:11:41 +00:00
Tim Peters 3b5e4d1e3c Cosmetic: break the long lines in test_ntpath.py, and get rid of its
expected-output file.
2001-07-19 19:02:12 +00:00
Fred Drake acd32d3be5 Added function xml.sax.saxutils.quoteattr().
This closes SF bug #440351.  It should not be moved to Python 2.1.1.
2001-07-19 16:10:15 +00:00
Fred Drake 1f4cc897f8 Remove a couple of lines from the test that proved not to be portable to
all platforms that offer tempnam().
2001-07-17 21:56:01 +00:00
Fred Drake 38c2ef0a4c Start of a test suite for the "os" module -- this only tests the temporary
file management functions that have just been made available on more
platforms.
2001-07-17 20:52:51 +00:00
Fred Drake 6e4f2c09df Use the "st" versions of the "ast" calls in the parser module -- there is
no reason to pretend the syntax trees we're dealing with are abstract.
2001-07-17 19:33:25 +00:00
Fred Drake cf580c7ea1 Added tests for the new yield support in the parser module.
(Should be merged with descr branch.)
2001-07-17 03:01:29 +00:00
Tim Peters 861adac23e This has never worked on Windows. Now it does. If it breaks on Unix now,
great, it's your turn to watch it fail for months <0.9 wink>.
2001-07-16 20:49:49 +00:00
Barry Warsaw 06069330e3 test_basic(): Add a test for "person@dom.ain (User J. Person)" which
was already correctly parsed (contrary to a comment in Mailman).

test_rfc2822_phrases(): RFC 2822 now requires that we allow `.' in
phrases, which means we must accept dots in unquoted realname parts.
Add a test to check the change in rfc822.py 1.58.
2001-07-16 20:44:16 +00:00
Fred Drake 19ff4ac7e9 Add a unit test for sgmllib (needs work, but has already caught problems).
Based on the test for the HTMLParser module.
2001-07-16 18:52:40 +00:00
Fred Drake 14f6c18b62 Give more useful information about a failing PyUnit-style test. 2001-07-16 18:51:32 +00:00
Fred Drake 50bc19fce5 Remove a duplicate test. 2001-07-16 18:50:29 +00:00
Tim Peters 5ba5866281 Part way to allowing "from __future__ import generators" to communicate
that info to code dynamically compiled *by* code compiled with generators
enabled.  Doesn't yet work because there's still no way to tell the parser
that "yield" is OK (unlike nested_scopes, the parser has its fingers in
this too).
Replaced PyEval_GetNestedScopes by a more-general
PyEval_MergeCompilerFlags.  Perhaps I should not have?  I doubted it was
*intended* to be part of the public API, so just did.
2001-07-16 02:29:45 +00:00
Guido van Rossum 0960015056 Should raise TestSkipped, not ImportError, when deciding to skip the
test.
2001-07-13 17:27:57 +00:00
Tim Peters 9a8c8e270b Having fun on my own time: quicker flat_conjoin; Knights Tour solver
simplified and generalized to rectangular boards.
2001-07-13 09:12:12 +00:00
Tim Peters a1d545523d Remove the last remnants of the hacks to worm around leaks. 2001-07-12 22:55:42 +00:00
Tim Peters 3446365c37 Repair flawed example. 2001-07-12 22:43:41 +00:00
Tim Peters c4889c496a Remove now-unnecessary "from __future__ import nested_scopes" stmts. 2001-07-12 22:36:02 +00:00
Neil Schemenauer b20e9dbf89 Remove reference cycle breaking code. The GC now takes care of it. 2001-07-12 13:26:41 +00:00
Neil Schemenauer 88c761a117 Test GC of frame objects. 2001-07-12 13:25:53 +00:00
Guido van Rossum 28358fbed6 Make the test pass now that 10**-15 returns a float instead of raising
an exception.
2001-07-12 12:51:22 +00:00
Tim Peters 3230d5c961 SF patch #440170: Tests for fileinput module.
New test_fileinput.py from Nick Mathewson, fiddled to use TESTFN and sundry
style nits.
2001-07-11 22:21:17 +00:00
Tim Peters 48dacc69a2 SF patch #440144: Tests and minor bugfix for uu module.
New test_uu.py from Nick Mathewson, fiddled to work on Windows too.
Somebody should check that it still works on non-Windows boxes, though!
2001-07-11 21:43:42 +00:00
Guido van Rossum 05be1a0fd6 Ported to Windows:
- Set the host to "localhost" instead of "".

- Skip the AF_UNIX tests when socket.AF_UNIX is not defined.
2001-07-10 15:46:34 +00:00
Guido van Rossum 39f1b3656e A test suite for SocketServer.py that exposes the various bugs just
fixed.  Regrettably, this must be run manually -- somehow the I/O
redirection of the regression test breaks the test.  When run under
the regression test, this raises ImportError with a warning to that
effect.

Bugfix candidate!
2001-07-10 11:52:38 +00:00
Fred Drake beb6713ea7 When reading a continuation line, make sure we still use the transformed
name when filling in the internal data structures, otherwise we incorrectly
raise a KeyError.

This fixes SF bug #432369.
2001-07-06 17:22:48 +00:00
Guido van Rossum c09cf33658 Rip out tests for xrange() features no longer supported. 2001-07-05 14:49:21 +00:00
unknown 31569561fd Added a non-recursive implementation of conjoin(), and a Knight's Tour
solver.  In conjunction, they easily found a tour of a 200x200 board:
that's 200**2 == 40,000 levels of backtracking.  Explicitly resumable
generators allow that to be coded as easily as a recursive solver (easier,
actually, because different levels can use level-customized algorithms
without pain), but without blowing the stack.  Indeed, I've never written
an exhaustive Tour solver in any language before that can handle boards so
large ("exhaustive" == guaranteed to find a solution if one exists, as
opposed to probabilistic heuristic approaches; of course, the age of the
universe may be a blip in the time needed!).
2001-07-04 22:11:22 +00:00
Fredrik Lundh df781e6a3f reapplied darryl gallion's minimizing repeat fix. I'm still not 100%
sure about this one, but test #133283 now works even with the fix in
place, and so does the test suite.  we'll see what comes up...
2001-07-02 19:54:28 +00:00
Tim Peters 353026663c A clever union-find implementation from c.l.py, due to David Eppstein.
This is another one that leaks memory without an explict clear!  Time to
bite this bullet.
2001-07-02 01:38:33 +00:00
Tim Peters c468fd28b6 Derive an industrial-strength conjoin() via cross-recursion loop unrolling,
and fiddle the conjoin tests to exercise all the new possible paths.
2001-06-30 07:29:44 +00:00
Tim Peters be4f0a7748 Added a simple but general backtracking generator (conjoin), and a couple
examples of use.  These poke stuff not specifically targeted before, incl.
recursive local generators relying on nested scopes, ditto but also
inside class methods and rebinding instance vars, and anonymous
partially-evaluated generators (the N-Queens solver creates a different
column-generator for each row -- AFAIK this is my invention, and it's
really pretty <wink>).  No problems, not even a new leak.
2001-06-29 02:41:16 +00:00
Tim Peters 08a898f85d Another "if 0:" hack, this time to complain about otherwise invisible
"return expr" instances in generators (which latter may be generators
due to otherwise invisible "yield" stmts hiding in "if 0" blocks).
This was fun the first time, but this has gotten truly ugly now.
2001-06-28 01:52:22 +00:00
Tim Peters f6ed0740a8 This no longer leaks memory when run in an infinite loop. However,
that required explicitly calling LazyList.clear() in the two tests that
use LazyList (I added a LazyList Fibonacci generator too).

A real bitch:  the extremely inefficient first version of the 2-3-5 test
*looked* like a slow leak on Win98SE, but it wasn't "really":  it generated
so many results that the heap grew over 4Mb (tons of frames!  the number
of frames grows exponentially in that test).  Then Win98SE malloc() starts
fragmenting address space allocating more and more heaps, and the visible
memory use grew very slowly while the disk was thrashing like mad.
Printing fewer results (i.e., keeping the heap burden under 4Mb) made
that illusion vanish.

Looks like there's no hope for plugging the LazyList leaks automatically
short of adding frameobjects and genobjects to gc.  OTOH, they're very
easy to break by hand, and they're the only *kind* of plausibly realistic
leaks I've been able to provoke.

Dilemma.
2001-06-27 07:17:57 +00:00
Martin v. Löwis ce9b5a55e1 Encode surrogates in UTF-8 even for a wide Py_UNICODE.
Implement sys.maxunicode.
Explicitly wrap around upper/lower computations for wide Py_UNICODE.
When decoding large characters with UTF-8, represent expected test
results using the \U notation.
2001-06-27 06:28:56 +00:00
Tim Peters e77f2e2798 gen_getattr: make the gi_running and gi_frame members discoverable (but
not writable -- too dangerous!) from Python code.
2001-06-26 22:24:51 +00:00
Barry Warsaw 41775385df Add a bunch of tests for extended dict.update() where the argument is
a non-dictionary mapping object.  Include tests for several expected
failure modes.
2001-06-26 20:09:28 +00:00
Tim Peters b6c3ceae79 SF bug #436207: "if 0: yield x" is ignored.
Not anymore <wink>.  Pure hack.  Doesn't fix any other "if 0:" glitches.
2001-06-26 03:36:28 +00:00
Tim Peters 3e7b1a04a0 Teach the types module about generators. Thanks to James Althoff on the
Iterators list for bringing it up!
2001-06-25 19:46:25 +00:00
Tim Peters 2106ef0222 Repair indentation in comment.
Add a temporary driver to help track down remaining leak(s).
2001-06-25 01:30:12 +00:00
Tim Peters b2bc6a93df Added a "generate k-combinations of a list" example posted to c.l.py. 2001-06-24 10:14:27 +00:00
Tim Peters ea2e97a08a New tests to provoke SyntaxErrors unique to generators. Minor fiddling
of other tests.
2001-06-24 07:10:02 +00:00
Tim Peters ee30927b45 Another variant of the 2-3-5 test, mixing generators with a LazyList class.
Good news:  Some of this stuff is pretty sophisticated (read nuts), and
I haven't bumped into a bug yet.
Bad news:  If I run the doctest in an infinite loop, memory is clearly
leaking.
2001-06-24 05:47:06 +00:00
Tim Peters b9e9ff1288 More tests. 2001-06-24 03:44:52 +00:00
Tim Peters 0f9da0acde Add a recursive Sieve of Eratosthenes prime generator. Not practical,
but it's a heck of a good generator exerciser (think about it <wink>).
2001-06-23 21:01:47 +00:00
Tim Peters 6ba5f79674 Add all the examples from PEP 255, and a few email examples. 2001-06-23 20:45:43 +00:00
Tim Peters 1def351b45 New std test for generators, initially populated with doctests NeilS put
together.
2001-06-23 20:27:04 +00:00
Tim Peters d6d010b874 Teach the UNPACK_SEQUENCE opcode how to tease an iterable object into
giving up the goods.
NEEDS DOC CHANGES
2001-06-21 02:49:55 +00:00
Barry Warsaw 7599a3fc5a Add a bunch of sample strings to test soft line breaks of varying end
cases.
2001-06-19 22:48:42 +00:00
Jack Jansen 97df7b61f2 The test used int(time.time()) to get a random number, but this doesn't work on the mac (where times are bigger than ints). Changed to int(time.time()%1000000). 2001-06-19 20:20:05 +00:00
Marc-André Lemburg a37171dd86 Test by Martin v. Loewis for the new UTF-16 codec handling of BOM
marks.
2001-06-19 20:09:28 +00:00
Barry Warsaw 7069763913 A unittest-based test for the quopri module. 2001-06-19 19:08:13 +00:00
Tim Peters 3eec38af37 Added "i" and "l" to the list of std-mode struct codes that don't range-
check correctly on pack().  While these were checking OK on my 32-bit box,
Mark Favas reported failures on a 64-bit box (alas, easy to believe).
2001-06-18 22:27:39 +00:00
Tim Peters 1dad6a86de SF bug 434186: 0x80000000/2 != 0x80000000>>1
i_divmod:  New and simpler algorithm.  Old one returned gibberish on most
boxes when the numerator was -sys.maxint-1.  Oddly enough, it worked in the
release (not debug) build on Windows, because the compiler optimized away
some tricky sign manipulations that were incorrect in this case.
Makes you wonder <wink> ...
Bugfix candidate.
2001-06-18 19:21:11 +00:00
Tim Peters 17e17d4406 Generalize the new qQ std-mode tests to all int codes (bBhHiIlLqQ).
Unfortunately, the std-mode bBhHIL codes don't do any range-checking; if
and when some of those get fixed, remove their letters from the
IntTester.BUGGY_RANGE_CHECK string.  In the meantime, a msg saying that
range-tests are getting skipped is printed to stdout whenever one is
skipped.
2001-06-13 22:45:27 +00:00
Tim Peters da9c5b35a3 The new {b,l}p_{u,}longlong() didn't check get_pylong()'s return for NULL.
Repaired that, and added appropriate tests for it to test_struct.py.
2001-06-13 01:26:35 +00:00
Tim Peters 7a3bfc3a47 Added q/Q standard (x-platform 8-byte ints) mode in struct module.
This completes the q/Q project.

longobject.c _PyLong_AsByteArray:  The original code had a gross bug:
the most-significant Python digit doesn't necessarily have SHIFT
significant bits, and you really need to count how many copies of the sign
bit it has else spurious overflow errors result.

test_struct.py:  This now does exhaustive std q/Q testing at, and on both
sides of, all relevant power-of-2 boundaries, both positive and negative.

NEWS:  Added brief dict news while I was at it.
2001-06-12 01:22:22 +00:00
Tim Peters c533edceb1 Renamed some stuff to tell the truth about what it does. 2001-06-10 23:52:59 +00:00
Tim Peters 7b9542a3f7 Initial support for 'q' and 'Q' struct format codes: for now, only in
native mode, and only when config #defines HAVE_LONG_LONG.  Standard mode
will eventually treat them as 8-byte ints across all platforms, but that
likely requires a new set of routines in longobject.c first (while
sizeof(long) >= 4 is guaranteed by C, there's nothing in C we can rely
on x-platform to hold 8 bytes of int, so we'll have to roll our own;
I'm thinking of a simple pair of conversion functions, Python long
to/from sized vector of unsigned bytes; that may be useful for GMP
conversions too; std q/Q would call them with size fixed at 8).

test_struct.py:  In addition to adding some native-mode 'q' and 'Q' tests,
got rid of unused code, and repaired a non-portable assumption about
native sizeof(short) (it isn't 2 on some Cray boxes).

libstruct.tex:  In addition to adding a bit of 'q'/'Q' docs (more needed
later), removed an erroneous footnote about 'I' behavior.
2001-06-10 23:40:19 +00:00
Fred Drake 58422e5820 Convert the parser module test to use PyUnit. 2001-06-04 03:56:24 +00:00
Martin v. Löwis 351c3d0554 Implement testGetElementsByTagNameNS. 2001-06-03 14:27:02 +00:00
Tim Peters 453163d842 lookdict: stop more insane core-dump mutating comparison cases. Should
be possible to provoke unbounded recursion now, but leaving that to someone
else to provoke and repair.
Bugfix candidate -- although this is getting harder to backstitch, and the
cases it's protecting against are mondo contrived.
2001-06-03 04:54:32 +00:00
Tim Peters fa517b277f Fix comment. 2001-06-02 08:18:58 +00:00
Tim Peters 23cf6be23c Coredumpers from Michael Hudson, mutating dicts while printing or
converting to string.
Critical bugfix candidate -- if you take this seriously <wink>.
2001-06-02 08:02:56 +00:00
Tim Peters 0b76d3a8d1 This division test was too stringent in its accuracy expectations for
random inputs:  if you ran the test 100 times, you could expect it to
report a bogus failure.  So loosened its expectations.
Also changed the way failing tests are printed, so that when run under
regrtest.py we get enough info to reproduce the failure.
2001-05-29 22:18:09 +00:00
Tim Peters 9a828d3c61 BadDictKey test: The output file expected "raising error" to be printed
exactly once.  But the test code can't know that, as the number of times
__cmp__ is called depends on internal details of the dict implementation.
This is especially nasty because the __hash__ method returns the address
of the class object, so the hash codes seen by the dict can vary across
runs, causing the dict to use a different probe order across runs.  I
just happened to see this test fail about 1 run in 7 today, but only
under a release build and when passing -O to Python.  So, changed the test
to be predictable across runs.
2001-05-29 21:14:32 +00:00
Fred Drake e51fe8d0a3 runtest(): When generating output, if the result is a single line with the
name of the test, only write the output file if it already exists (and
    tell the user to consider removing it).  This avoids the generation of
    unnecessary turds.
2001-05-29 17:10:51 +00:00
Fred Drake 4f1e495fa0 The one-line output files are no longer needed, so do not keep them. 2001-05-29 16:54:22 +00:00
Jeremy Hylton bea3947fb8 Variety of test cases for call to builtin functions 2001-05-29 16:26:20 +00:00
Tim Peters 3a2ab1ab69 Whitespace normalization. 2001-05-29 06:06:54 +00:00
Tim Peters 0c6010be75 Jack Jansen hit a bug in the new dict code, reported on python-dev.
dictresize() was too aggressive about never ever resizing small dicts.
If a small dict is entirely full, it needs to rebuild it despite that
it won't actually resize it, in order to purge old dummy entries thus
creating at least one virgin slot (lookdict assumes at least one such
exists).

Also took the opportunity to add some high-level comments to dictresize.
2001-05-23 23:33:57 +00:00
Guido van Rossum 54a069f271 When Tim untabified this file, his editor accidentally assumed 4-space
tabs.  The title was centered using 8-byte tabs, however, and the
result looked strange.  Fixed this.
2001-05-23 13:24:30 +00:00
Tim Peters f5f6c436c6 Remove test_doctest's expected-output file.
Change test_doctest and test_difflib to pass regrtest's notion of
verbosity on to doctest.
Add explanation for a dozen "new" things to test/README.
2001-05-23 07:46:36 +00:00
Fred Drake a6daad2e55 Update to reflect recent changes to regrtest and the new approaches to
testing using doctest and PyUnit.
2001-05-23 04:57:49 +00:00
Tim Peters dec4a6143c Remove test_difflib's output file and change test_difflib to stop
generating it.  Since this is purely a doctest, the output file never
served a good purpose.
2001-05-23 01:45:19 +00:00
Fred Drake b8e76a7b3d Remove output files that are no longer needed since the corresponding
tests were moved to PyUnit.
2001-05-22 22:32:24 +00:00
Fred Drake cf99225312 Move the sha tests to PyUnit. 2001-05-22 21:43:17 +00:00
Fred Drake 275dfda633 Convert binhex regression test to PyUnit. We could use a better test
for this.
2001-05-22 21:01:14 +00:00
Fred Drake 5379d05dc3 Convert copy_reg test to PyUnit. 2001-05-22 20:38:44 +00:00
Fred Drake 970a53cb3e Remove unused import. 2001-05-22 20:25:05 +00:00
Fred Drake babd7378a3 Simple conversion to PyUnit -- this test really needs more work! 2001-05-22 20:22:06 +00:00
Fred Drake 64fe52351a Convert dospath test suite to PyUnit, adding a couple more cases for
isabs() (no false results were checked) and splitdrive().
2001-05-22 20:20:49 +00:00
Fred Drake 876dc70b2e Re-write the rfc822 tests to use PyUnit.
Update to reflect using "" as the default value for the second parameter
to the get() method.
2001-05-22 19:38:31 +00:00
Tim Peters d97422115e Implementing an idea from Guido on the checkins list:
When regrtest.py finds an attribute "test_main" in a test it imports,
regrtest runs the test's test_main after the import.  test_threaded_import
needs this else the cross-thread import lock prevents it from making
progress.  Other tests can use this hack too, but I doubt it will ever be
popular.
2001-05-22 18:28:25 +00:00
Fred Drake bc5619826e Convert time module tests to PyUnit. 2001-05-22 17:02:02 +00:00
Fred Drake d992c2c74d Migrate the strop test to PyUnit. 2001-05-22 16:44:33 +00:00
Tim Peters 6626c1f183 create_message(): When os.link() doesn't exist, make a copy of the msg
instead.  Allows this test to finish on Windows again.
2001-05-22 16:29:01 +00:00
Fred Drake cf71fefa59 Add tests for the new .get() and .setdefault() methods of rfc822.Message
objects.
2001-05-22 15:02:19 +00:00
Tim Peters aa222234c0 New test adapted from the ancient Demo/threads/bug.py.
ICK ALERT:  read the long comment block before run_the_test().  It was
almost impossible to get this to run without instant deadlock, and the
solution here sucks on several counts.  If you can dream up a better way,
let me know!
2001-05-22 09:34:27 +00:00
Fred Drake febbe33a49 Remove all files of expected output that contain only the name of the
test; there is no need to store this in a file if the actual test code
does not produce any output.
2001-05-21 21:12:10 +00:00
Fred Drake ae1bb176be If the file containing expected output does not exist, assume that it
contains a single line of text giving the name of the output file.  This
covers all tests that do not actually produce any output in the test code.
2001-05-21 21:08:12 +00:00
Fred Drake c02bc3e819 Re-write the mailbox test suite to use PyUnit. Cover a lot more ground
for the Maildir mailbox format.  This still does not address other mailbox
formats.
2001-05-21 20:23:21 +00:00
Fred Drake acb117eb11 Update a comment. 2001-05-18 21:50:02 +00:00
Fred Drake 97656a1c82 Simple conversion to PyUnit. 2001-05-18 21:45:35 +00:00
Fred Drake 5b811bee5d Simple conversion to PyUnit. 2001-05-18 21:38:52 +00:00
Fred Drake bd3090d4d6 Added test suite for the new HTMLParser module, originally from the
TAL/PageTemplate package for Zope.  This only needed a little boilerplate
change; the tests themselves are unchanged.
2001-05-18 15:32:59 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Guido van Rossum 2e0a654f6e Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.
2001-05-15 02:14:44 +00:00
Fred Drake 992d387540 Convert a couple of comments to docstrings -- PyUnit can use these when
the regression test is run in verbose mode.
2001-05-14 19:15:23 +00:00
Tim Peters 95b3f78622 pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
2001-05-14 18:39:41 +00:00
Fred Drake 43913dd27c Convert the pprint test to use PyUnit. 2001-05-14 17:41:20 +00:00
Tim Peters a814db579d SF bug[ #423781: pprint.isrecursive() broken. 2001-05-14 07:05:58 +00:00
Mark Hammond ef8b654bbe Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. 2001-05-13 08:04:26 +00:00