Commit graph

1077 commits

Author SHA1 Message Date
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