Commit Graph

480 Commits

Author SHA1 Message Date
Mark Hammond 8696ebcd28 Add os.path.supports_unicode_filenames for all platforms,
sys.getwindowsversion() on Windows (new enahanced Tim-proof <wink>
version), and fix test_pep277.py in a few minor ways.
Including doc and NEWS entries.
2002-10-08 02:44:31 +00:00
Mark Hammond 7995eb22f1 Tests for pep277 - Unicode file names on Windows NT. 2002-10-03 23:14:10 +00:00
Neal Norwitz b567392bbf SF bug # 585792, Invalid mmap crashes Python interpreter
Raise ValueError if user passes a size to mmap which is larger
than the file.
2002-09-05 21:48:07 +00:00
Guido van Rossum 602d45194c Add a custom __str__ method to KeyError that applies repr() to the
missing key.  (Also added a guard to SyntaxError__str__ to prevent
calling PyString_Check(NULL).)
2002-09-03 20:24:09 +00:00
Guido van Rossum fc26c0730c Undo Barry's change. This file is not imported, it's fed as input to
the tokenize module by test_tokenize.py.  The FutureWarnings only
appeared during installation, and I've figured out a way to suppress
those in a different way.
2002-08-29 15:10:30 +00:00
Barry Warsaw c6f80fd995 The test_tokenize output has changed slightly, by the addition of some
trailing `L's.
2002-08-29 12:56:59 +00:00
Fred Drake c441f7b3a6 Follow PyXML: Remove all prints from successful tests. This means we can
also drop the output file.
2002-07-19 22:16:41 +00:00
Tim Peters 012b69cb30 The atexit module effectively turned itself off if sys.exitfunc already
existed at the time atexit first got imported.  That's a bug, and this
fixes it.

Also reworked test_atexit.py to test for this too, and to stop using
an "expected output" file, and to test what actually happens at exit
instead of just simulating what it thinks atexit will do at exit.

Bugfix candidate, but it's messy so I'll backport to 2.2 myself.
2002-07-16 19:30:59 +00:00
Jeremy Hylton 6d0a4c79cf Fix for SF bug #432621: httplib: multiple Set-Cookie headers
If multiple header fields with the same name occur, they are combined
according to the rules in RFC 2616 sec 4.2:

Appending each subsequent field-value to the first, each separated by
a comma. The order in which header fields with the same field-name are
received is significant to the interpretation of the combined field
value.
2002-07-07 16:51:37 +00:00
Martin v. Löwis 7d650ca83b Implement the encoding argument for toxml and toprettyxml.
Document toprettyxml.
2002-06-30 15:05:00 +00:00
Fred Drake 3a159a8d25 Suppress the variable verbose output from test.xmltests; the inclusion of
timing information in the output makes the determination of success bogus.
2002-06-26 15:16:16 +00:00
Fred Drake 867de944b4 Add convenience module to run all the XML tests. 2002-06-25 19:20:10 +00:00
Guido van Rossum 24e4af8c72 New test suite for the socket module by Michael Gilfix.
Changed test_timeout.py to conform to the guidelines in Lib/test/README.
2002-06-12 19:18:08 +00:00
Raymond Hettinger 2d2b51bf22 Added tests for new degree/radian conversions. 2002-05-14 08:51:33 +00:00
Jeremy Hylton 74ce77f0e6 Add tests for the recent resource module change.
Also add a test that Python doesn't die with SIGXFSZ if it exceeds the
file rlimit.  (Assuming this will also test the behavior when the 2GB
limit is exceed on a platform that doesn't have large file support.)
2002-04-23 20:21:22 +00:00
Jeremy Hylton 954aed8c8d Add test for eval() w/ free variables.
Related to SF bug #505315
2002-04-20 04:51:39 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Mark Hammond e7fefbf68d Fix bugs:
457466: popenx() argument mangling hangs python
 226766: popen('python -c"...."') tends to hang

Fixes argument quoting in w9xpopen.exe for Windows 9x.  w9xpopen.exe
also never attempts to display a MessageBox when not executed
interactively.

Added test_popen() test.  This test currently just executes
"python -c ..." as a child process, and checks that the expected
arguments were all recieved correctly by the child process.  This
test succeeds for me on Win9x, win2k and Linux, and I hope it does
for other popen supported platforms too :)
2002-04-03 01:47:00 +00:00
Skip Montanaro 74e77e89de add test for InvalidURL 2002-03-24 16:54:38 +00:00
Neil Schemenauer eff724490f Add more tests for built-in types. Add tests for buffer objects.
Closes SF patch 494871.
2002-03-24 01:24:54 +00:00
Skip Montanaro b1ba6b0044 no longer needed - converted test_urlparse.py to use unittest 2002-03-23 05:29:59 +00:00
Michael W. Hudson bd3e771a97 amk's fix attached to
[ 516299 ] urlparse can get fragments wrong
2002-03-18 13:06:00 +00:00
Andrew M. Kuchling 1bf71172f8 As part of fixing bug #523301, add a simple test of ConfigParser.write() 2002-03-08 18:10:12 +00:00
Guido van Rossum 06ee2531a8 SF patch #523169, by Samuele Pedroni.
There were never tests for the fact that list() always returns a *new*
list object, even when the argument is a list, while tuple() may
return a reference to the argument when it is a tuple.  Now there are.
2002-02-26 22:39:23 +00:00
Marc-André Lemburg bd3be8f0ca Fix to the UTF-8 encoder: it failed on 0-length input strings.
Fix for the UTF-8 decoder: it will now accept isolated surrogates
(previously it raised an exception which causes round-trips to
fail).

Added new tests for UTF-8 round-trip safety (we rely on UTF-8 for
marshalling Unicode objects, so we better make sure it works for
all Unicode code points, including isolated surrogates).

Bumped the PYC magic in a non-standard way -- please review. This
was needed because the old PYC format used illegal UTF-8 sequences
for isolated high surrogates which now raise an exception.
2002-02-07 11:33:49 +00:00
Jeremy Hylton 3095a4c228 Update output generated by test_scope 2001-12-13 19:47:51 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Fred Drake 2998a55f2d Attribute nodes did not always get their ownerDocument and ownerElement
properly set.  This fixes that.
2001-12-06 18:27:48 +00:00
Fred Drake e50959a58e Fix appendChild() and insertBefore() (and replaceChild() indirectly) when
the node being added is a fragment node.
This closes SF bug #487929.
2001-12-06 04:32:18 +00:00
Marc-André Lemburg 0c4d8d05a8 Fix for bug #480188: printing unicode objects 2001-11-20 15:17:25 +00:00
Tim Peters 5ebfd36afa CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps.  A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
2001-11-13 23:11:19 +00:00
Jeremy Hylton 8edd5402f0 Fix SF buf #480096: Assign to __debug__ still allowed
Easy enough to catch assignment in the compiler.  The perverse user
can still change the value of __debug__, but that may be the least he
can do.
2001-11-09 20:37:13 +00:00
Marc-André Lemburg b5507ecd3c Additional test and documentation for the unicode() changes.
This patch should also be applied to the 2.2b1 trunk.
2001-10-19 12:02:29 +00:00
Guido van Rossum 4114a4afec Fix the frozen bytecode for __hello__ (betcha didn't know that existed
:-).

Add a test that prevents the __hello__ bytecode from going stale
unnoticed again.

The test also tests the loophole noted in SF bug #404545.  This test
will fail right now; I'll check in the fix in a minute.
2001-10-18 18:49:37 +00:00
Jeremy Hylton cf672f15e0 Add test for local assigned to only in a nested list comp 2001-10-18 16:23:11 +00:00
Jeremy Hylton 511e2cacc4 [ #403753 ] zlib decompress; uncontrollable memory usage
Mostly by Toby Dickenson and Titus Brown.

Add an optional argument to a decompression object's decompress()
method.  The argument specifies the maximum length of the return
value.  If the uncompressed data exceeds this length, the excess data
is stored as the unconsumed_tail attribute.  (Not to be confused with
unused_data, which is a separate issue.)

Difference from SF patch: Default value for unconsumed_tail is ""
rather than None.  It's simpler if the attribute is always a string.
2001-10-16 20:39:49 +00:00
Jeremy Hylton 6642653875 Covert pickle tests to use unittest.
Extend tests to cover a few more cases.  For cPickle, test several of
the undocumented features.
2001-10-15 21:38:56 +00:00
Fred Drake 168beada91 Added tests that check getboolean() with the newly allowed values from
SF patch #467580.
2001-10-08 17:13:12 +00:00
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