Commit Graph

792 Commits

Author SHA1 Message Date
Fredrik Lundh 1c5aa6901f bumped SRE version number to 2.1. cleaned up and added 1.5.2
compatibility patches.
2001-01-16 07:37:30 +00:00
Ka-Ping Yee 10bc59320c Ugh. Sorry. Checked in the wrong file. Please ignore revision 1.3;
it anticipates another patch i was about to propose.
2001-01-15 22:27:06 +00:00
Ka-Ping Yee 27ac0d1ff5 better format names and error messages 2001-01-15 22:21:39 +00:00
Ka-Ping Yee 2057970601 This patch makes sure that the function name always appears in the error
message, and tries to make the messages more consistent and helpful when
the wrong number of arguments or duplicate keyword arguments are supplied.
Comes with more tests for test_extcall.py and and an update to an error
message in test/output/test_pyexpat.
2001-01-15 22:14:16 +00:00
Ka-Ping Yee 1ff08b1243 Add tokenizer support and tests for u'', U"", uR'', Ur"", etc. 2001-01-15 22:04:30 +00:00
Barry Warsaw 534c60f9ab Add a test case suggested by Guido, where a method is created with the
new module.
2001-01-15 21:00:02 +00:00
Barry Warsaw 4a420a0a75 Committing PEP 232, function attribute feature, approved by Guido.
Closes SF patch #103123.

Regression test for function attributes, with output file.
2001-01-15 20:30:15 +00:00
Fredrik Lundh 2e24044f9d from the really-stupid-bug department: uppercase literals should match
uppercase strings also when the IGNORECASE flag is set (bug #128899)

(also added test cases for recently fixed bugs to the regression suite
-- or in other words, check in re_tests.py too...)
2001-01-15 18:28:14 +00:00
Fredrik Lundh fa25a7d51f -- don't use recursion for unbounded non-greedy repeat
(bugs #115903, #115696)

This is based on a patch by Darrel Gallion.  I'm not 100%
sure about this fix, but I haven't managed to come up with
any test case it cannot handle...
2001-01-14 23:55:55 +00:00
Fredrik Lundh 538f05c94d reapplied Fred's "recommended style" patch... 2001-01-14 15:15:37 +00:00
Fredrik Lundh 770617b23e SRE fixes for 2.1 alpha:
-- added some more docstrings
-- fixed typo in scanner class (#125531)
-- the multiline flag (?m) should't affect the \Z operator (#127259)
-- fixed non-greedy backtracking bug (#123769, #127259)
-- added sre.DEBUG flag (currently dumps the parsed pattern structure)
-- fixed a couple of glitches in groupdict (the #126587 memory leak
   had already been fixed by AMK)
2001-01-14 15:06:11 +00:00
Tim Peters 2caf8df868 SF bug 128713: type(mmap_object) blew up on Linux. 2001-01-14 05:05:51 +00:00
Tim Peters 73cbc5e616 Fix stupidity. 2001-01-13 03:45:59 +00:00
Tim Peters 9fadfb0d1d Guido found a brand new race in tempfile on Linux, due to Linux changing
pid across threads (but in that case, it's still the same process, and so
still sharing the "template" cache in tempfile.py).  Repaired that, and
added a new std test.
On Linux, someone please run that standalone with more files and/or more
threads; e.g.,

    python lib/test/test_threadedtempfile.py -f 1000 -t 10

to run with 10 threads each creating (and deleting) 1000 temp files.
2001-01-13 03:04:02 +00:00
Marc-André Lemburg ef34274d3b Moved the test codec definition to a new module and updated the test and
codec to test all charmap codec features.

As side-effect of moving the test codec into a new module, the encodings
package codec import mechanism is checked as well.
2001-01-10 10:21:11 +00:00
Tim Peters 58c82f0b56 Assorted xreadlines problems:
Wasn't built on Windows; not in config.c either.
    Module init function missing DL_EXPORT magic.
    test_xreadline output file obviously wrong (started w/ "test_xrl").
    test program very unclear about what was expected.
2001-01-09 23:26:39 +00:00
Guido van Rossum 07b78a8778 Test for xreadline. 2001-01-09 21:47:44 +00:00
Tim Peters 3a55f950a9 18 isn't a prime (duh). 2001-01-08 01:17:26 +00:00
Tim Peters 86821b2563 MS Win32 .readline() speedup, as discussed on Python-Dev. This is a tricky
variant that never needs to "search from the right".
Also fixed unlikely memory leak in get_line, if string size overflows INTMAX.
Also new std test test_bufio to make sure .readline() works.
2001-01-07 21:19:34 +00:00
Fred Drake e3fb18c1c4 Add more regression tests, including for the import statement variations.
These will detect regression on SF bug #127271 and other import statement
bugs.
2001-01-07 06:02:19 +00:00
Marc-André Lemburg 1109db443e This patch adds a new feature to the builtin charmap codec:
the mapping dictionaries can now contain 1-n mappings, meaning
that character ordinals may be mapped to strings or Unicode object,
e.g. 0x0078 ('x') -> u"abc", causing the ordinal to be replaced by
the complete string or Unicode object instead of just one character.

Another feature introduced by the patch is that of mapping oridnals to
the emtpy string. This allows removing characters.

The patch is different from patch #103100 in that it does not cause a
performance hit for the normal use case of 1-1 mappings.

Written by Marc-Andre Lemburg, copyright assigned to Guido van Rossum.
2001-01-06 15:09:57 +00:00
Fred Drake a4d18a008f Add test cases based on RFC 1808. So now we actually have a test suite
the urljoin() function, which exercises the urlparse() and urlunparse()
functions as side effects.

(Moshe, why did we have perfectly empty tests checked in for this?)
2001-01-05 05:57:04 +00:00
Fred Drake 1a7aab70d1 When a PyCFunction that takes only positional parameters is called with
an empty keywords dictionary (via apply() or the extended call syntax),
the keywords dict should be ignored.  If the keywords dict is not empty,
TypeError should be raised.  (Between the restructuring of the call
machinery and this patch, an empty dict in this situation would trigger
a SystemError via PyErr_BadInternalCall().)

Added regression tests to detect errors for this.
2001-01-04 22:33:02 +00:00
Neil Schemenauer 0ee7d8233f No more RCmp. 2001-01-04 01:36:50 +00:00
Neil Schemenauer 623116a870 Sequence repeat works now for in-place multiply with an integer type
as the left operand.  I don't know if this is a feature or a bug.
2001-01-04 01:36:25 +00:00
Neil Schemenauer aa726ba991 __rcmp__ no longer gets called on instances. Remove the test for it. 2001-01-04 01:34:52 +00:00
Neil Schemenauer 38f0223c9c Numbers no longer compare smaller than all other types. Fix the only
part of the testsuite that breaks.  The old behavior may be restored.
2001-01-04 01:33:41 +00:00
Jeremy Hylton 5ab366119e Actually call the object with an __call__ method, instead of just
checking if it is callable.  This is the only place in the test suite
where an __call__ method is called.
2001-01-03 23:53:31 +00:00
Marc-André Lemburg a866df806d This patch changes the default behaviour of the builtin charmap
codec to not apply Latin-1 mappings for keys which are not found
in the mapping dictionaries, but instead treat them as undefined
mappings.

The patch was originally written by Martin v. Loewis with some
additional (cosmetic) changes and an updated test script
by Marc-Andre Lemburg.

The standard codecs were recreated from the most current files
available at the Unicode.org site using the Tools/scripts/gencodec.py
tool.

This patch closes the bugs #116285 and #119960.
2001-01-03 21:29:14 +00:00
Neil Schemenauer e7e694fd22 Use == rather than cmp(). The return value of cmp() is not well defined when
comparing different types.
2001-01-03 02:13:26 +00:00
Neil Schemenauer 38796d07a5 Use numbers that can be accurately represented on binary machines. I hope
this works on all platforms.
2001-01-03 01:52:11 +00:00
Andrew M. Kuchling 6d0cee1170 Add forgotten import 2001-01-02 20:56:42 +00:00
Neil Schemenauer fd288c7cd5 Add more tests for compare and coercion in preparation for the coercion
overhaul.  Closes SF patch #102878.
2001-01-02 16:30:31 +00:00
Andrew M. Kuchling ad4a558af8 Added test case for legal DOM children 2000-12-31 04:03:27 +00:00
Tim Peters 1a4d77b252 Christmas present to myself: changed regrtest in two ways:
1. When running in verbose mode, if any test happens to pass, print
   a warning that the apparent success may be bogus (stdout isn't
   compared in verbose mode).  Been fooled by that too often.
2. When a test fails because the expected stdout doesn't match the
   actual stdout, print as much of stdout as did match before the
   first failing write.  Else we get failures of the form "expected
   'a', got 'b'" and a glance at the expected output file shows
   500 instances of 'a' -- no idea where it failed, and, as in #1,
   trying to run in verbose mode instead doesn't help because
   stdout isn't compared then.
2000-12-30 22:21:22 +00:00
Tim Peters 36cdad12dd Fred, THIS NEEDS DOCS! The function docstrings tell the tale.
Christmas present to myself:  the bisect module didn't define what
happened if the new element was already in the list.  It so happens
that it inserted the new element "to the right" of all equal elements.
Since it wasn't defined, among other bad implications it was a mystery
how to use bisect to determine whether an element was already in the
list (I've seen code that *assumed* "to the right" without justification).
Added new methods bisect_left and insort_left that insert "to the left"
instead; made the old names bisect and insort aliases for the new names
bisect_right and insort_right; beefed up docstrings to explain what
these actually do; and added a std test for the bisect module.
2000-12-29 02:06:45 +00:00
Tim Peters da7bf4e236 Add test case for SF bug
https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
2000-12-27 08:03:20 +00:00
Fred Drake 1e0611b208 The "context" parameter to the ExternalEntityRefParameter exposes internal
information from the Expat library that is not part of its public API.
Do not print this information as the format of the string may (and will)
change as Expat evolves.

Add additional tests to make sure the ParserCreate() function raises the
right exceptions on illegal parameters.
2000-12-23 22:12:07 +00:00
Fred Drake 9a1a7dda8f The regression test for the regex module should not trip the deprecation
warning for that module, so suppress just that one warning.
2000-12-23 22:08:27 +00:00
Andrew M. Kuchling c867f74a10 Change expected message for ValueError, fixing bug #126400 2000-12-20 00:55:46 +00:00
Guido van Rossum 70f128861f Use binary mode to open "wave" files. 2000-12-19 06:32:57 +00:00
Guido van Rossum 8b26454273 Test more split argument combinations:
1) multi-char separator
2) multi-char separator that only occurs at last position
3) all of the above with mixed Unicode and 8-bit-string arguments
2000-12-19 02:22:31 +00:00
Guido van Rossum 8b74b15b92 Test some Unicode pickling endcases. 2000-12-19 02:01:12 +00:00
Neil Schemenauer 99664e455b gdbm.open() no longer accepts garbage in the flags string. Fix the tests. 2000-12-18 17:28:05 +00:00
Fred Drake 1703cf662c Before calling traceback.print_exc(), call sys.stdout.flush(). This makes
it much easier to see where things went wrong.
2000-12-15 21:31:59 +00:00
Andrew M. Kuchling 4d192b37ec Add test case for error message raised by bad % format character
(Oh, look, it adds another little utility function for testing)
2000-12-15 13:09:06 +00:00
Fred Drake 3277da0f33 Update the test suite to cover more ground.
This closes patch #102477.
2000-12-14 18:20:22 +00:00
Fred Drake 132dce2246 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Guido van Rossum b822c6138e Added test for {}.popitem(). 2000-12-12 22:02:59 +00:00
Fred Drake e1578ce204 Added tests to avoid regression on bug #125375.
roundtrip():  Show the offending syntax tree when things break; this makes
              it a little easier to debug the module by adding test cases.

(Still need better tests for this module, but there's not enough time
 today.)
2000-12-11 22:12:09 +00:00
Fred Drake 3d5f7e83c7 Add test cases for ConfigParser.remove_option() behavior. This includes
coverage to ensure bug #124324 does not re-surface.
2000-12-04 16:30:40 +00:00
Moshe Zadka 5725d1eb03 Backing out my changes.
Improved version coming soon to a Source Forge near you!
2000-11-30 19:30:21 +00:00
Moshe Zadka 1a62750eda Added .first{item,value,key}() to dictionaries.
Complete with docos and tests.
OKed by Guido.
2000-11-30 12:31:03 +00:00
Tim Peters a3a3a030af Fox for SF bug #123859: %[duxXo] long formats inconsistent. 2000-11-30 05:22:44 +00:00
Guido van Rossum 15ffc71c0f Slight improvement to Unicode test suite, inspired by patch #102563:
also test join method of 8-bit strings.

Also changed the test() function to (1) compare the types of the
expected and actual result, and (2) in verbose mode, print the repr()
of the output.
2000-11-29 12:13:59 +00:00
Fred Drake b7f0cef54d Update test output. 2000-11-21 22:03:09 +00:00
Fred Drake a1bde802f1 testInsertBefore(): Rewritten to actually test insertBefore() somewhat.
testAAA(),
testAAB():  Added checks that the results are right.

testTooManyDocumentElements():  Added code to actually test this.

testCloneElementDeep()
testCloneElementShallow():  Filled these in with test code.

_testCloneElementCopiesAttributes(),
_setupCloneElement():  Helper functions used with the other
        testCloneElement*() functions.

testCloneElementShallowCopiesAttributes():  No longer a separate test;
        _setupCloneElement() uses _testCloneElementCopiesAttributes() to
        test that this is always done.

testNormalize():  Added to check Node.normalize().
2000-11-21 22:02:43 +00:00
Tim Peters cc78e47bcd Verify that str(a) and repr(a) don't blow up (part of SF patch 102068). 2000-11-14 21:36:07 +00:00
Fred Drake b046b76322 Added test cases to detect regression on SourceForge bug #121965. 2000-11-08 19:51:25 +00:00
Fredrik Lundh fad27aee11 Added 38,642 missing characters to the Unicode database (first-last
ranges) -- but thanks to the 2.0 compression scheme, this doesn't add
a single byte to the resulting binaries (!)

Closes bug #117524
2000-11-03 20:24:15 +00:00
Jeremy Hylton 24ec6fbc7e track recent change to test_extcall.py 2000-10-30 19:41:33 +00:00
Jeremy Hylton 6b4ec5135b Fix for SF bug #117241
When a method is called with no regular arguments and * args, defer
the first arg is subclass check until after the * args have been
expanded.

N.B. The CALL_FUNCTION implementation is getting really hairy; should
review it to see if it can be simplified.
2000-10-30 17:15:20 +00:00
Fredrik Lundh ebc37b28fa -- properly reset groups in findall (bug #117612)
-- fixed negative lookbehind to work correctly at the beginning
of the target string (bug #117242)

-- improved syntax check; you can no longer refer to a group
inside itself (bug #110866)
2000-10-28 19:30:41 +00:00
Fred Drake 661ea26b3d Ka-Ping Yee <ping@lfw.org>:
Changes to error messages to increase consistency & clarity.

This (mostly) closes SourceForge patch #101839.
2000-10-24 19:57:45 +00:00
Guido van Rossum bd6f4fba1b Insert the current directory to the front of sys.path -- and remove it
at the end.  This fixes a problem where

	python Lib/test/test_import.py

failed while "make test" succeeded.
2000-10-24 17:16:32 +00:00
Lars Gustäbel 0702507ea2 Added a test case for the saxutils.prepare_input_source setSystemId bug. 2000-10-24 16:00:22 +00:00
Lars Gustäbel cfd3bd838c Updated output. 2000-10-24 15:36:28 +00:00
Lars Gustäbel 2fc5294911 Added some more tests here and there. 2000-10-24 15:35:07 +00:00
Fred Drake 098b55ab44 Make reindent happy, but not in the way it planned! 2000-10-23 17:30:23 +00:00
Fred Drake 004d5e6880 Make reindent.py happy (convert everything to 4-space indents!). 2000-10-23 17:22:08 +00:00
Fred Drake 2e6d25c5bb Use 4-space indents. 2000-10-23 17:00:30 +00:00
Fred Drake 2ec80faae5 Clean up the temporary file when done with it. 2000-10-23 16:59:35 +00:00
Fred Drake dce5641856 Make sure the temporary file is cleaned up even when we raise TestSkipped. 2000-10-23 16:38:20 +00:00
Fred Drake 44b6bd2179 Added note saying to use test_support.TESTFN for a temporary filename,
and be clear that you need to clean it up when done.
2000-10-23 16:37:14 +00:00
Fred Drake 0aaed272a7 Added test for regression on SourceForge bug #117490. 2000-10-23 13:39:15 +00:00
Fred Drake f7ef15d6ec Use test_support.TESTFN as the temporary filename.
Fix a minor stylistic nit.

This closes SourceForge bug #117032.
2000-10-18 01:21:38 +00:00
Tim Peters 98c8184f2f Test for math.* exceptional behavior only in verbose mode, so that the
oddball platforms (where, e.g., math.exp(+huge) still fails to raise
OverflowError) don't fail the std test suite when run normally.
2000-10-16 17:35:13 +00:00
Lars Gustäbel 5bad5a4be2 Updated test suite to latest pulldom changes. 2000-10-13 20:54:10 +00:00
Neil Schemenauer 8a00abc0ff Make the regrtest.py -l (findleaks) option considerably less obnoxious.
First, only report garbage that the GC cannot free.  Second, only report
the number of objects found, not their repr().  People can dig deeper on
their own if they find a leak.
2000-10-13 01:32:42 +00:00
Jeremy Hylton 3b0c600394 cosmetic changes only:
use standard Python style for whitespace near = and ()
2000-10-12 17:31:36 +00:00
Guido van Rossum 22d5895dc3 Added a test for the StringIO write() error I just fixed. 2000-10-12 16:46:28 +00:00
Guido van Rossum 2e2a70abe4 Anonymous patch to add Darwin 1.2 to the list of BSDs.
Let's hope this is correct (I'm not sure why the sys.platform would be
'Darwin1.2' rather than 'darwin1', which seems to be the convention).

Someone with Darwin please test this!
2000-10-12 16:01:55 +00:00
Barry Warsaw 0157e7aa3e Added some single tuple/list unpacking for JPython regression testing. 2000-10-12 14:45:58 +00:00
Tim Peters cb5b5bac11 A Mystery: I somehow managed to delete the last two lines of my test_math.py
changes.  Here restoring them.
2000-10-12 07:15:55 +00:00
Tim Peters 1d120619d4 Stop raising OverflowError on underflows reported by libm (errno==ERANGE and
libm result is 0).  Cautiously add a few libm exception test cases:
1. That exp(-huge) returns 0 without exception.
2. That exp(+huge) triggers OverflowError.
3. That sqrt(-1) raises ValueError specifically (apparently under glibc linked
   with -lieee, it was raising OverflowError due to an accident of the way
   mathmodule.c's CHECK() macro happened to deal with Infs and NaNs under gcc).
2000-10-12 06:10:25 +00:00
Lars Gustäbel f27f5ab31f Added additional test cases for pulldom modifications. 2000-10-11 22:36:00 +00:00
Fred Drake cb953d72d2 Test the exception-raising for error cases in copy_reg. 2000-10-11 22:17:35 +00:00
Guido van Rossum 4bbea05c4e Jack Jansen reported that the regression test failed on the Mac where
string.letters was much more than expected.

Solution: explicit is better than implicit; don't rely on
string.letters.
2000-10-11 21:34:53 +00:00
Barry Warsaw 7e3e1c1ece Added test cases for extended printing to an instance. This picked up
a bug in JPython where the instance had to have a flush() method.
2000-10-11 21:26:03 +00:00
Guido van Rossum 16b198e10e wave test output 2000-10-09 20:06:50 +00:00
Guido van Rossum a00afc1ead Simple test suite for wave.py by Jean-Claude Rimbault (with some
changes to avoid using assert).
2000-10-09 20:05:59 +00:00
Fred Drake ebe73025cd Move the test for confirmation that all nodes have been freed into the
driver code, so that each test gets this; it had been done inconsistently.
Remove the lines that set the variables holding dom objects to None; not
needed since the interpreter cleans up locals on function return.
2000-10-09 19:57:39 +00:00
Guido van Rossum e9f922f497 Adapt test output to changed error message. 2000-10-08 19:48:46 +00:00
Guido van Rossum ce6292ebf5 Correct output. 2000-10-08 00:21:43 +00:00
Guido van Rossum 923ebe4dc6 It seems our sound cards can't play mulaw data. Use native-format
16-bit signed data instead.  Hope this works for you; it works for me.
2000-10-08 00:20:20 +00:00
Fredrik Lundh 13ac9926ac Fixed too ambitious "nothing to repeat" check. Closes bug #114033. 2000-10-07 17:38:23 +00:00
Fred Drake 5c0b43d1e2 The test is good, but Jim forgot to check in the updated output. 2000-10-07 16:58:11 +00:00
Fredrik Lundh 025468d246 SRE didn't handle character category followed by hyphen inside a
character class.  Fix provided by Andrew Kuchling.  Closes bug
#116251.
2000-10-07 10:16:19 +00:00
Marc-André Lemburg b96d80201c Updated test with a case which checks for the bug reported in 2000-10-07 08:52:45 +00:00
Martin v. Löwis 0a84a338f9 Add .toxml test case, as proposed by Alex Martelli in bug report #116244. 2000-10-06 22:42:55 +00:00