Commit Graph

442 Commits

Author SHA1 Message Date
Guido van Rossum f137f75ab8 Hopefully fix the profiler right. Add a test suite that checks that
it deals correctly with some anomalous cases; according to this test
suite I've fixed it right.

The anomalous cases had to do with 'exception' events: these aren't
generated when they would be most helpful, and the profiler has to
work hard to recover the right information.  The problems occur when C
code (such as hasattr(), which is used as the example here) calls back
into Python code and clears an exception raised by that Python code.
Consider this example:

    def foo():
        hasattr(obj, "bar")

Where obj is an instance from a class like this:

    class C:
        def __getattr__(self, name):
            raise AttributeError

The profiler sees the following sequence of events:

    call (foo)
    call (__getattr__)
    exception (in __getattr__)
    return (from foo)

Previously, the profiler would assume the return event returned from
__getattr__. An if statement checking for this condition and raising
an exception was commented out...  This version does the right thing.
2001-10-04 00:58:24 +00:00
Fred Drake 946f7b1b24 Update the xml.dom.minidom tests to cover the DOM-compliant parts of the
NodeList interface.
2001-09-28 20:31:50 +00:00
Thomas Wouters 80d373cbd0 Test case for SF bugs #463359 and #462937, added to test_grammar for lack of
a better place. Excessively fragile code, but at least it breaks when
something in this area changes!
2001-09-26 12:43:39 +00:00
Barry Warsaw 7f8ff471f8 Converted test_StringIO.py to use unittest, so
Lib/test/output/test_StringIO is no longer necessary.

Also, added a test of the iterator protocol that's just been added to
StringIO's and cStringIO's.
2001-09-22 04:33:47 +00:00
Marc-André Lemburg 3508e30861 Fix Unicode .join() method to raise a TypeError for sequence
elements which are not Unicode objects or strings. (This matches
the string.join() behaviour.)

Fix a memory leak in the .join() method which occurs in case
the Unicode resize fails.

Restore the test_unicode output.
2001-09-20 17:22:58 +00:00
Marc-André Lemburg 5e89bd656f Update test output after the unicode() change. 2001-09-20 16:37:23 +00:00
Tim Peters 32f453eaa4 New restriction on pow(x, y, z): If z is not None, x and y must be of
integer types, and y must be >= 0.  See discussion at
http://sf.net/tracker/index.php?func=detail&aid=457066&group_id=5470&atid=105470
2001-09-03 08:35:41 +00:00
Jeremy Hylton 4de8df92e9 Add tests for augmented floor division 2001-08-29 17:50:27 +00:00
Guido van Rossum ea46fa8494 Undo previous checkin -- Barry fixed it better. 2001-08-24 19:46:21 +00:00
Guido van Rossum d320ad08bf Update test output to match new (more informative) error message about
calling unbound method with wrong first argument.
2001-08-24 19:31:43 +00:00
Tim Peters 4e2fbce71c Looks like someone forgot the change the expected output file. 2001-08-24 04:33:10 +00:00
Tim Peters 971e0690c4 Remove test_long's expected-output file. 2001-08-23 20:34:01 +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
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
Fred Drake cd112f5546 Added tests for rich comparison operator functions.
Converted tests to PyUnit.
2001-08-11 03:21:35 +00:00
Fred Drake eaa77e2ca1 Added tests for operator.floordiv() and operator.truediv(). 2001-08-09 20:23:08 +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
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 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
Martin v. Löwis 3bd071e3f7 Patch #442866: Tests for codeop.py. 2001-07-30 12:30:08 +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 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
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 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
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 d992c2c74d Migrate the strop test to PyUnit. 2001-05-22 16:44:33 +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 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 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
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
Tim Peters 2f228e75e4 Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints <sigh>, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) & mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash & mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

>>> d = {}
>>> for i in range(10):
...    d[i] = i
...
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
2001-05-13 00:19:31 +00:00
Tim Peters 95bf9390a4 SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Bugfix candidate.
2001-05-10 08:32:44 +00:00
Jeremy Hylton e3e61049a5 Trivial tests of urllib2 for recent SF bug 2001-05-09 15:50:25 +00:00
Jeremy Hylton 4c889011db SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
2001-05-08 04:08:59 +00:00
Tim Peters 6912d4ddf0 Generalize tuple() to work nicely with iterators.
NEEDS DOC CHANGES.
This one surprised me!  While I expected tuple() to be a no-brainer, turns
out it's actually dripping with consequences:
1. It will *allow* the popular PySequence_Fast() to work with any iterable
   object (code for that not yet checked in, but should be trivial).
2. It caused two std tests to fail.  This because some places used
   PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test
   whether something *is* a sequence.  But tuple() code only looked for the
   existence of sq->item to determine that, and e.g. an instance passed
   that test whether or not it supported the other operations tuple()
   needed (e.g., __len__).  So some things the tests *expected* to fail
   with an AttributeError now fail with a TypeError instead.  This looks
   like an improvement to me; e.g., test_coercion used to produce 559
   TypeErrors and 2 AttributeErrors, and now they're all TypeErrors.  The
   error details are more informative too, because the places calling this
   were *looking* for TypeErrors in order to replace the generic tuple()
   "not a sequence" msg with their own more specific text, and
   AttributeErrors snuck by that.
2001-05-05 03:56:37 +00:00
Jeremy Hylton ddc4fd03b1 Fix 2.1 nested scopes crash reported by Evan Simpson
The new test case demonstrates the bug.  Be more careful in
symtable_resolve_free() to add a var to cells or frees only if it
won't be added under some other rule.

XXX Add new assertion that will catch this bug.
2001-04-27 02:29:40 +00:00
Fred Drake 8f42e2b1fa Update test to accomodate the change to the namespace_separator parameter
of ParserCreate().

Added assignment tests for the ordered_attributes and specified_attributes
values, similar to the checks for the returns_unicode attribute.
2001-04-25 16:03:54 +00:00
Guido van Rossum 8b48cf9016 Add test suite for iterators. 2001-04-21 13:33:54 +00:00
Jeremy Hylton 3090694068 Fix compileall.py so that it fails on SyntaxErrors
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail.  It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.

Fixes SF bug #412436

This change affects the test suite, which contains several files that
contain intentional errors.  The solution is to extend compileall.py
with the ability to skip compilation of selected files.

In the test suite, rename nocaret.py and test_future[3..7].py to start
with badsyntax_nocaret.py and badsyntax_future[3..7].py.  Update the
makefile to skip compilation of these files.  Update the tests to use
the name names for imports.

NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.
2001-04-18 01:19:28 +00:00
Jeremy Hylton 79fa2b6073 Add test for SF bug #405427 2001-04-13 14:57:44 +00:00
Jeremy Hylton 3bee2f6011 Update to reflect new tokenize_test.py 2001-04-13 14:55:18 +00:00
Martin v. Löwis 88ad12afac Patch #415777: new grouping strategy.
fixes bug #414940, and redoes the fix for #129417 in a different way.
It also fixes a number of other problems with locale-specific formatting:
If there is leading or trailing spaces, then no grouping should be applied
in the spaces, and the total length of the string should not be changed
due to grouping.
Also added test case which works only if the en_US locale is available.
2001-04-13 08:09:50 +00:00
Jeremy Hylton ceccc3c037 Test cases for examples of ext call error handling.
Fix to SF bug #414743 based on Michael Hudson's patch #414750.
2001-04-11 13:53:35 +00:00
Tim Peters eb26f95906 Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing to
have the std test suite exercise the Cookie doctests too.
2001-04-06 21:20:58 +00:00
Guido van Rossum 66172520ee Add test for asynchat. This also tests asyncore. 2001-04-06 16:32:22 +00:00
Fred Drake b0fefc5121 Convert the weakref test suite to PyUNIT, and add tests that exercise weak
references on function objects and both bound and unbound methods.
2001-03-23 04:22:45 +00:00
Fredrik Lundh 015415ed14 SRE 2.1b2: increase the chances that the sre test works on other
machines...
2001-03-22 23:48:28 +00:00
Fredrik Lundh 987f1332fe SRE 2.1b2: forgot to update one output file (sorry, Fred!) 2001-03-22 23:29:04 +00:00
Tim Peters 24a4191160 Changed doctest to run tests in alphabetic order of name.
This makes verbose-mode output easier to dig thru, and removes an accidental
dependence on the order of dict.items() (made visible by recent changes to
dictobject.c).
2001-03-21 23:07:59 +00:00
Jeremy Hylton 09ccc3a22a Test that traceback module works with SyntaxErrors with or without carets. 2001-03-21 20:33:04 +00:00
Fred Drake 91751143eb Add test cases for the fnmatch module. 2001-03-21 18:29:25 +00:00
Jeremy Hylton 5c7a2513ec Add tests for recent changes:
- global stmt in class does not affect free vars in methods
- locals() works with free and cell vars
2001-03-21 16:44:39 +00:00
Jeremy Hylton e241e29f3d Add test for a list comprehension that is nested in the left-hand part
of another list comp.  This caused crashes reported as SF bugs 409230
and 407800.

Note that the new tests are in a function so that the name lookup code
isn't affected by how many *other* list comprehensions are in the same
scope.
2001-03-19 20:42:11 +00:00
Tim Peters 9e6f278fc1 Repair test_doctest's expected-output file (Guido added some new output). 2001-03-18 20:14:25 +00:00
Tim Peters 0f33604e17 SF bug [ #409448 ] Complex division is braindead
http://sourceforge.net/tracker/?func=detail&aid=409448&group_id=5470&atid=105470
Now less braindead.  Also added test_complex.py, which doesn't test much, but
fails without this patch.
2001-03-18 08:21:57 +00:00
Jeremy Hylton 5b44a67bdb Add test to verify that nested functions with free variables don't
cause the free variables to leak.
2001-03-13 02:01:12 +00:00
Tim Peters fc35de409b test_global was broken by some recent checkin. Repairing. 2001-03-02 01:48:16 +00:00
Guido van Rossum 9aa643cf69 Test interaction of global and nested scopes -- thanks to Samuele Pedroni. 2001-03-01 20:35:45 +00:00
Jeremy Hylton 2922ea8235 Add test case for global stmt at module level.
Fix test_grammar so that it ignores warning about global stmt at
module level in exec.
2001-02-28 23:49:19 +00:00
Jeremy Hylton 42efed0fc3 update output to reflect exception that is now raised 2001-02-28 23:24:22 +00:00
Jeremy Hylton 62e2c7e3df Add regression test for future statements. This adds eight files, but
seven are not tests in their own right; these files are mentioned in
regrtest.
2001-02-28 17:48:06 +00:00
Jeremy Hylton 8e43cd7929 verify that warnings are issued for bogus uses of global 2001-02-28 01:51:01 +00:00
Martin v. Löwis 5e1633365d Patch #403985: Add support for weak-keyed dictionaries 2001-02-27 18:36:56 +00:00
Ka-Ping Yee 6397c7c9a9 inspect: a module for getting information out of live Python objects 2001-02-27 14:43:21 +00:00
Fred Drake 3c823aa4b6 Make sure ConfigParser uses .optionxform() consistently; this affects
.has_option(), .remove_option(), and .set().

This closes SF tracker #232913.
2001-02-26 21:55:34 +00:00
Tim Peters ffc215a279 Add __future__.py to std library, + dull test to verify that assignments
therein are of the proper form.
2001-02-26 21:14:49 +00:00
Andrew M. Kuchling 9a0f98e0a1 Add test case from bug #124981: zlib decompress of sync-flushed data
fails
2001-02-21 02:17:01 +00:00
Andrew M. Kuchling 8b94b1c74a Added test for patch #103473: test an unquoted cookie value containing '=' 2001-02-21 01:17:54 +00:00
Jeremy Hylton 121b6eb018 SF patch #103749: implicit tuple + default arg 2001-02-19 23:53:42 +00:00
Jeremy Hylton f828e2d737 Add simple section for assert, including assert w/ lambdas 2001-02-19 15:54:52 +00:00
Jeremy Hylton 4779399e9f Add test for syntax error on "x = 1 + 1".
Move check_syntax() function into test_support.
2001-02-19 15:35:26 +00:00
Tim Peters 60e23f4cfc Change doctest exception example to one whose detail hasn't changed since 1.5.2. 2001-02-14 00:43:21 +00:00
Tim Peters ea4f931cb9 Teach doctest about newer "(most recent call last)" traceback spelling. 2001-02-13 20:54:42 +00:00
Fred Drake 95b96d3941 Added options that use square brackets in their names; this ensures that
GNOME-style internationalized options can be parsed using ConfigParser
(SF bug #131635).

Converted the tests to use test_support.verify() instead of output
comparison to work.
2001-02-12 17:23:20 +00:00
Tim Peters 9ae2148ada Moved SequenceMatcher from ndiff into new std library module difflib.py.
Guido told me to do this <wink>.
Greatly expanded docstrings, and fleshed out with examples.
New std test.
Added new get_close_matches() function for ESR.
Needs docs, but LaTeXification of the module docstring is all it needs.
\CVS: ----------------------------------------------------------------------
2001-02-10 08:00:53 +00:00
Tim Peters 6db54c69a4 Add std test for doctest. 2001-02-10 01:36:47 +00:00
Jeremy Hylton cafd495dfe In O_writelines: Replace use of string.joinfields with "".join. 2001-02-09 23:44:22 +00:00
Jeremy Hylton 97a01674b2 update test cases for recent compiler changes: exec/import * in nested
functinos and cell vars with */** parameters
2001-02-09 22:56:46 +00:00
Jeremy Hylton de6024872a Fix test 9 (caught by ?!ng)
Add tests for unbound locals (Nick Mathewson)
2001-02-05 17:35:20 +00:00
Jeremy Hylton 5e7cb240af Add minimal interface to symtable: _symtable module. 2001-02-02 18:24:26 +00:00
Tim Peters 9ea17ac595 Patch derived from Trent's 101162: a Python/C API testing framework.
STILL NEEDS UNIX BUILD CHANGES.
2001-02-02 05:57:15 +00:00
Jeremy Hylton 3faa52ecc4 Allow 'continue' inside 'try' clause
SF patch 102989 by Thomas Wouters
2001-02-01 22:48:12 +00:00
Jeremy Hylton 483638c9a8 Undo recent change that banned using import to bind a global, as per
discussion on python-dev.  'from mod import *' is still banned except
at the module level.

Fix value for special NOOPT entry in symtable.  Initialze to 0 instead
of None, so that later uses of PyInt_AS_LONG() are valid.  (Bug
reported by Donn Cave.)

replace local REPR macros with PyObject_REPR in object.h
2001-02-01 20:20:45 +00:00
Fred Drake 41deb1efc2 PEP 205, Weak References -- initial checkin. 2001-02-01 05:27:45 +00:00
Jeremy Hylton ac25a38841 add test for illegal imports 2001-01-30 01:25:56 +00:00
Jeremy Hylton 619eea6821 PEP 227 implementation
test_new: new.code() noew takes two more arguments
test_grammer: Add a bunch of test cases for lambda (not really PEP 227 related)
2001-01-25 20:12:27 +00:00
Jeremy Hylton 4588c78faf PEP 227 implementation
New tests cases for nested scopes.
2001-01-25 20:11:23 +00:00
Jeremy Hylton 92e9f29aec add extra tests to verify that co_varnames is being set up properly
also normalize checks for syntax errors and delete commented out
definition of verify.
2001-01-25 17:03:37 +00:00
Guido van Rossum 42756df91c Fix the test output, now that escapes in repr() of string and Unicode
are different (Ping didn't test this).
2001-01-24 21:49:57 +00:00
Guido van Rossum 0fc8b74fc5 Fix the test output, now that escapes in repr() of string and Unicode
are different (Ping couldn't test this).
2001-01-24 21:46:18 +00:00
Ka-Ping Yee fa004ad36c Show '\011', '\012', and '\015' as '\t', '\n', '\r' in strings.
Switch from octal escapes to hex escapes for other nonprintable characters.
2001-01-24 17:19:08 +00:00
Jeremy Hylton 578ceee042 Add simple test of list comprehension that uses a name that isn't
otherwise used in the same code block.  (Not sure this is the right
place, but there is no test_list_comprehensions.py.)
2001-01-23 01:51:40 +00:00
Tim Peters e935816164 Reorganize pickle/cPickle testing so the tests pass regardless of the order
they're run.
2001-01-22 22:05:20 +00:00
Tim Peters d304f44906 Patch #103343: Allow the important test_pkg to succeed under Jython. 2001-01-21 19:51:53 +00:00
Tim Peters 08dabf0a73 Patch #103344: Sort dicts from extcall for easier comparison with Jython. 2001-01-21 18:52:02 +00:00
Skip Montanaro e99d5ea25b added __all__ lists to a number of Python modules
added test script and expected output file as well
this closes patch 103297.
__all__ attributes will be added to other modules without first submitting
a patch, just adding the necessary line to the test script to verify
more-or-less correct implementation.
2001-01-20 19:54:20 +00:00
Guido van Rossum 0a5f91f1d9 Now that Marc-Andre has retracted unistr(), remove the tests. 2001-01-19 21:57:52 +00:00
Fredrik Lundh 2acb54a194 improved the ucnhash test a bit 2001-01-19 11:13:46 +00:00
Tim Peters d93c0b6a37 Jeremy's patch #103323: trivial tests of all untested modules. 2001-01-19 05:41:36 +00:00
Jeremy Hylton b4ed8c4db0 add test of bastion and rexec to std regression test suite 2001-01-19 03:22:48 +00:00
Guido van Rossum 2f1064c77b A dumb test for the dumdbm module. 2001-01-18 16:46:52 +00:00
Guido van Rossum c4a6e8b65a Rich comparison tests 2001-01-18 15:48:05 +00:00
Marc-André Lemburg ad7c98e264 This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects.

A new C API PyObject_Unicode() is also provided.

This closes patch #101664.

Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
2001-01-17 17:09:53 +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 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
Tim Peters 2caf8df868 SF bug 128713: type(mmap_object) blew up on Linux. 2001-01-14 05:05:51 +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 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
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 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
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 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
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 3277da0f33 Update the test suite to cover more ground.
This closes patch #102477.
2000-12-14 18:20:22 +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 b7f0cef54d Update test output. 2000-11-21 22:03:09 +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
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
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
Fred Drake 0aaed272a7 Added test for regression on SourceForge bug #117490. 2000-10-23 13:39:15 +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
Guido van Rossum 22d5895dc3 Added a test for the StringIO write() error I just fixed. 2000-10-12 16:46:28 +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 16b198e10e wave test output 2000-10-09 20:06:50 +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