summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* Generalize reduce() to work with iterators.Tim Peters2001-05-041-0/+13
| | | | NEEDS DOC CHANGES.
* Purge redundant cut&paste line.Tim Peters2001-05-031-2/+1
|
* Generalize map() to work with iterators.Tim Peters2001-05-031-0/+35
| | | | | | | | | | | NEEDS DOC CHANGES. Possibly contentious: The first time s.next() yields StopIteration (for a given map argument s) is the last time map() *tries* s.next(). That is, if other sequence args are longer, s will never again contribute anything but None values to the result, even if trying s.next() again could yield another result. This is the same behavior map() used to have wrt IndexError, so it's the only way to be wholly backward-compatible. I'm not a fan of letting StopIteration mean "try again later" anyway.
* Remove redundant copy+paste code.Tim Peters2001-05-031-3/+0
|
* Generalize max(seq) and min(seq) to work with iterators.Tim Peters2001-05-031-0/+35
| | | | NEEDS DOC CHANGES.
* Fix for bug #417030: "print '%*s' fails for unicode string"Marc-André Lemburg2001-05-021-0/+6
|
* Generalize filter(f, seq) to work with iterators. This also generalizesTim Peters2001-05-021-0/+44
| | | | | filter() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES.
* Whitespace normalization.Tim Peters2001-05-021-2/+2
|
* Added tests for Weak*Dictionary iterator support.Fred Drake2001-05-021-10/+54
| | | | Refactored some object initialization to be more reusable.
* Generalize list(seq) to work with iterators. This also generalizes list()Tim Peters2001-05-011-0/+32
| | | | | | | | | | | | | to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. This is meant to be a model for how other functions of this ilk (max, filter, etc) can be generalized similarly. Feel encouraged to grab your favorite and convert it! Note some cute consequences: list(file) == file.readlines() == list(file.xreadlines()) list(dict) == dict.keys() list(dict.iteritems()) = dict.items() list(xrange(i, j, k)) == range(i, j, k)
* Fix 2.1 nested scopes crash reported by Evan SimpsonJeremy Hylton2001-04-272-0/+12
| | | | | | | | 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.
* Update test to accomodate the change to the namespace_separator parameterFred Drake2001-04-252-10/+32
| | | | | | | of ParserCreate(). Added assignment tests for the ordered_attributes and specified_attributes values, similar to the checks for the returns_unicode attribute.
* Add test suite for iterators.Guido van Rossum2001-04-212-0/+247
|
* Give UserDict new __contains__ and __iter__ methods.Tim Peters2001-04-211-1/+15
|
* Implement, test and document "key in dict" and "key not in dict".Guido van Rossum2001-04-201-0/+4
| | | | | | | | | I know some people don't like this -- if it's really controversial, I'll take it out again. (If it's only Alex Martelli who doesn't like it, that doesn't count as "real controversial" though. :-) That's why this is a separate checkin from the iterators stuff I'm about to check in next.
* Fix compileall.py so that it fails on SyntaxErrorsJeremy Hylton2001-04-1810-16/+11
| | | | | | | | | | | | | | | | | | | | | 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.
* Add a test case for Weak*Dictionary.update() that would have caught aFred Drake2001-04-161-0/+25
| | | | recently reported bug; also exposed some other bugs in the implementation.
* Change the test data to ask for class C from module __main__ ratherGuido van Rossum2001-04-161-2/+3
| | | | | | than from module pickletester. Using the latter turned out to cause the test to break when invoked as "import test.test_pickle" or "import test.autotest".
* In order to make this test work on Windows, the test locale has to beGuido van Rossum2001-04-151-2/+7
| | | | | set to 'en' there -- Windows does not understand the 'en_US' locale. The test succeeds there.
* Set the SO_REUSEADDR socket option in the server thread -- this seemsGuido van Rossum2001-04-151-0/+1
| | | | | needed on some platforms (e.g. Solaris 8) when the test is run twice in quick succession.
* Add "import thread" at the top of the module; this prevents us fromGuido van Rossum2001-04-142-0/+2
| | | | | failing later when Python is compiled without threading but a failing 'threading' module can be imported due to an earlier (caught) attempt.
* If the sunaudiodev module is available but we cannot find an audioFred Drake2001-04-141-1/+9
| | | | | | | device to use, skip this test instead of allowing an error to occur when we attempt to play sound on the absent device. Verified by Mark Favas.
* Added regression test for SF bug #415660 (failure to invalidate allFred Drake2001-04-131-5/+24
| | | | | | references to an object before calling registered callbacks). Change last uses of verify() to self.assert_().
* Fix typo in comment (the module is now called _testcapi, not _test).Guido van Rossum2001-04-131-1/+1
|
* Change error message raised when free variable is not yet bound. ItJeremy Hylton2001-04-131-1/+2
| | | | | | | | | now raises NameError instead of UnboundLocalError, because the var in question is definitely not local. (This affects test_scope.py) Also update the recent fix by Ping using get_func_name(). Replace tests of get_func_name() return value with call to get_func_desc() to match all the other uses.
* Add test for SF bug #405427Jeremy Hylton2001-04-132-0/+36
|
* Update to reflect new tokenize_test.pyJeremy Hylton2001-04-131-8/+8
|
* There's no need for the tokenize tests to include a SyntaxError.Jeremy Hylton2001-04-131-1/+1
|
* Patch #415777: new grouping strategy.Martin v. Löwis2001-04-132-0/+38
| | | | | | | | | 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.
* Bug 415514 reported that e.g.Tim Peters2001-04-121-4/+4
| | | | | | | | | | | | "%#x" % 0 blew up, at heart because C sprintf supplies a base marker if and only if the value is not 0. I then fixed that, by tolerating C's inconsistency when it does %#x, and taking away that *Python* produced 0x0 when formatting 0L (the "long" flavor of 0) under %#x itself. But after talking with Guido, we agreed it would be better to supply 0x for the short int case too, despite that it's inconsistent with C, because C is inconsistent with itself and with Python's hex(0) (plus, while "%#x" % 0 didn't work before, "%#x" % 0L *did*, and returned "0x0"). Similarly for %#X conversion.
* Fix for SF bug #415514: "%#x" % 0 caused assertion failure/abort.Tim Peters2001-04-121-0/+16
| | | | | | | | | | | | | http://sourceforge.net/tracker/index.php?func=detail&aid=415514&group_id=5470&atid=105470 For short ints, Python defers to the platform C library to figure out what %#x should do. The code asserted that the platform C returned a string beginning with "0x". However, that's not true when-- and only when --the *value* being formatted is 0. Changed the code to live with C's inconsistency here. In the meantime, the problem does not arise if you format a long 0 (0L) instead. However, that's because the code *we* wrote to do %#x conversions on longs produces a leading "0x" regardless of value. That's probably wrong too: we should drop leading "0x", for consistency with C, when (& only when) formatting 0L. So I changed the long formatting code to do that too.
* Reverting the "unixware7" patch: atan2(0, 1) should be 0, regardless ofTim Peters2001-04-121-5/+1
| | | | | platform. If it returns pi on the unixware7 platform, they have a bug in their libm atan2.
* Unixware 7 support by Billy G. Allie (SF patch 413011)Guido van Rossum2001-04-113-3/+10
|
* Test cases for examples of ext call error handling.Jeremy Hylton2001-04-112-0/+40
| | | | Fix to SF bug #414743 based on Michael Hudson's patch #414750.
* Use the WeakKeyDictionary and WeakValueDictionary classes directlyFred Drake2001-04-101-2/+2
| | | | instead of using the mapping() function.
* Some other tests, when failing, don't always remove their TESTFN file.Guido van Rossum2001-04-101-0/+6
| | | | Try to do it for them, so our mkdir() operation doesn't fail.
* When doing the quick test to see whether large files are supported,Guido van Rossum2001-04-101-1/+1
| | | | | | catch IOError as well as OverflowError. I found that on Tru64 Unix this was raised; probably because the OS (or libc) doesn't support large files but the architecture is 64 bits!
* When zlib can't be imported, zipfile raises RuntimeError, which causesGuido van Rossum2001-04-101-0/+1
| | | | | the test to be marked as failing rather than skipped. Add an explicit "import zlib" to prevent this.
* Test full range of native ints. This exposes two more binary pickleTim Peters2001-04-101-0/+19
| | | | | | | | | bugs on sizeof(long)==8 machines. pickle.py has no idea what it's doing with very large ints, and variously gets things right by accident, computes nonsense, or generates corrupt pickles. cPickle fails on cases 2**31 <= i < 2**32: since it *thinks* those are 4-byte ints (the "high 4 bytes" are all zeroes), it stores them in the (signed!) BININT format, so they get unpickled as negative values.
* Pickles have a number of storage formats for various sizes and kinds ofTim Peters2001-04-091-13/+40
| | | | | | | | | integers, but the std tests don't exercise most of them. Repair that. CAUTION: I expect this to fail on boxes with sizeof(long)==8, in the part of test_cpickle (but not test_pickle) trying to do a binary mode (not text mode) load of the embedded BINDATA pickle string. Once that hypothesized failure is confirmed, I'll fix cPickle.c.
* No functional change -- just added whitespace in places so I could followTim Peters2001-04-091-11/+30
| | | | the logic better. Will be adding some additional tests later today.
* Whitespace normalization.Tim Peters2001-04-081-2/+2
|
* Since Guido fiddled Cookie.py to work with doctest, it's a Good Thing toTim Peters2001-04-062-0/+5
| | | | have the std test suite exercise the Cookie doctests too.
* Remove lines for asynchat & asyncore, as they've now got their own test.Tim Peters2001-04-061-2/+0
|
* After testing the test on Unix, several improvements:Guido van Rossum2001-04-061-3/+4
| | | | | | - Use push() instead of send(), and make these calls in main(). - Sleep a second to give the server thread time to initialize itself.
* Add test for asynchat. This also tests asyncore.Guido van Rossum2001-04-062-0/+58
|
* Sf bug [ #412214 ] ZipFile constructor leaves files open.Tim Peters2001-04-041-0/+16
| | | | | | This applies the patch Fred Drake created to fix it. I'm checking it in since I had to apply the patch anyway in order to test its behavior on Windows.
* Whitespace normalization.Tim Peters2001-03-292-5/+5
|
* Based on info from Jens@digicool.com, add 'darwin1' to the list ofGuido van Rossum2001-03-281-1/+1
| | | | BSD-style OS'es. Makes sense, really.
* Itamar Shtull-Trauring <itamar@maxnm.com>:Fred Drake2001-03-261-10/+27
| | | | | Add support to zipfile to support opening an archive represented by an open file rather than a file name.