Commit Graph

320 Commits

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