summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* Make these modules work when Python is compiled without Unicode support.Guido van Rossum2001-09-211-0/+4
|
* Add tests for repr() of strings containing string quotes as well.Guido van Rossum2001-09-211-0/+4
|
* Test basic functioning of unicode repr(). (If this breaks Jython,Guido van Rossum2001-09-211-0/+11
| | | | please let me know and we'll figure out how to fix the test.)
* Add a small test to verify that member and getset descriptors now haveGuido van Rossum2001-09-201-0/+8
| | | | docstrings (using file.closed and file.name as examples).
* Change testdescr.py to use the test_main() approach.Guido van Rossum2001-09-201-4/+4
|
* Change the PyUnit-based tests to use the test_main() approach. ThisFred Drake2001-09-2034-39/+229
| | | | | allows using the tests with unittest.py as a script. The tests will still run when run as a script themselves.
* Fix Unicode .join() method to raise a TypeError for sequenceMarc-André Lemburg2001-09-201-1/+0
| | | | | | | | | | 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.
* Update test output after the unicode() change.Marc-André Lemburg2001-09-201-0/+1
|
* Implement the changes proposed in patch #413333. unicode(obj) nowMarc-André Lemburg2001-09-201-0/+5
| | | | | works just like str(obj) in that it tries __str__/tp_str on the object in case it finds that the object is not a string or buffer.
* Patch #435971: UTF-7 codec by Brian Quinlan.Marc-André Lemburg2001-09-201-1/+28
|
* run_suite(): Oops, update a docstring.Barry Warsaw2001-09-201-1/+1
|
* run_suite(): Factor this out of run_unittest() for tests that buildBarry Warsaw2001-09-201-2/+7
| | | | | | | | their own test suite from a multitude of classes (like test_email.py will be doing). run_unittest(): Call run_suite() after making a suite from the testclass.
* Add additional coercion support for "self subtypes" to int, long,Guido van Rossum2001-09-191-0/+28
| | | | float (compare the recent checkin to complex). Added tests for these.
* Enable two checks for comparing a complex to a complex subtypeGuido van Rossum2001-09-191-3/+4
| | | | | | | | | instance. Split a string comparison test in two halves, replacing "a==b==a" with separate tests for a==b and b==a. (Reason: while experimenting, this test failed, and I wanted to know if it was the first or the second == operator that failed.)
* Enable some comparison tests that failed before. Still having problemsTim Peters2001-09-181-3/+3
| | | | with subsclasses of complex and string.
* Add a similar test for rich comparisons.Guido van Rossum2001-09-181-1/+67
|
* fixed #449964: sre.sub raises an exception if the template contains aFredrik Lundh2001-09-181-0/+3
| | | | | | \g<x> group reference followed by a character escape (also restructured a few things on the way to fixing #449000)
* Hopefully fix 3-way comparisons. This unfortunately adds yet anotherGuido van Rossum2001-09-181-0/+28
| | | | | | | | hack, and it's even more disgusting than a PyInstance_Check() call. If the tp_compare slot is the slot used for overrides in Python, it's always called. Add some tests that show what should work too.
* Get rid of a superfluous space after "--" in the message printed for aGuido van Rossum2001-09-181-2/+1
| | | | skipped test -- the print command already supplies a space.
* Test for the safety check in wrap_cmpfunc().Guido van Rossum2001-09-181-0/+15
|
* an SRE bugfix a day keeps Guido away...Fredrik Lundh2001-09-181-0/+4
| | | | | | | #462270: sub-tle difference between pre.sub and sre.sub. PRE ignored an empty match at the previous location, SRE didn't. also synced with Secret Labs "sreopen" codebase.
* Undo some (but not all) of the more lenient acceptance ofGuido van Rossum2001-09-181-9/+9
| | | | (AttributeError, TypeError) -- the leniency wasn't needed everywhere.
* - Some tests that check that assignments are not allowed expect thisGuido van Rossum2001-09-181-85/+95
| | | | | | | | | | | | | | | | to raise TypeError. In practice, a disallowed attribute assignment can raise either TypeError or AttributeError (and it's unclear which is better). So allow either. (Yes, this is in anticipation of a code change that switches the exception raised. :-) - Add a utility function, cantset(), which verifies that setting a particular attribute to a given value is disallowed, and also that deleting that same attribute is disallowed. Use this in the test_func_*() tests. - Add a new set of tests that test conformance of various instance method attributes. (Also in anticipation of code that changes their implementation.)
* Whitespace normalization.Tim Peters2001-09-182-4/+1
|
* Make test_socketserver require the network resource.Tim Peters2001-09-182-0/+3
| | | | Add it back to the list of tests we expect to skip on Windows.
* I don't expect test_socketserver to get skipped on Windows anymore.Tim Peters2001-09-181-1/+0
|
* Rework akin to test_threaded_import, so that this can run under regrtest.Tim Peters2001-09-171-7/+8
| | | | | Also raise TestSkipped (intead of appearing to fail) if the import lock is held.
* Rewrite function attributes to use the generic routines properly.Guido van Rossum2001-09-171-1/+158
| | | | | This uses the new "restricted" feature of structmember, and getset descriptors for some of the type checks.
* PyObject_Dir(): Merge in __members__ and __methods__ too (if they exist,Tim Peters2001-09-171-0/+8
| | | | | | | | | | | | | | | and are lists, and then just the string elements (if any)). There are good and bad reasons for this. The good reason is to support dir() "like before" on objects of extension types that haven't migrated to the class introspection API yet. The bad reason is that Python's own method objects are such a type, and this is the quickest way to get their im_self etc attrs to "show up" via dir(). It looks much messier to move them to the new scheme, as their current getattr implementation presents a view of their attrs that's a untion of their own attrs plus their im_func's attrs. In particular, methodobject.__dict__ actually returns methodobject.im_func.__dict__, and if that's important to preserve it doesn't seem to fit the class introspection model at all.
* Since we had a bug with multiplication of dynamic long subclasses, add aTim Peters2001-09-151-1/+6
| | | | little test to make sure it doesn't come back.
* A fix for SF bug #461546 (bug in long_mul).Guido van Rossum2001-09-151-0/+13
| | | | | | | | | Both int and long multiplication are changed to be more careful in their assumptions about when one of the arguments is a sequence: the assumption that at least one of the arguments must be an int (or long, respectively) is still held, but the assumption that these don't smell like sequences is no longer true: a subtype of int or long may well have a sequence-repeat thingie!
* The 'p' (Pascal string) pack code acts unreasonably when the string sizeTim Peters2001-09-151-0/+25
| | | | | and count exceed 255. Changed to preserve as much of the string as possible (instead of count%256 characters).
* limit prefix test for lambdaJeremy Hylton2001-09-141-1/+1
| | | | | the compiler package generates a module-unique trailing suffix for each lambda
* Changed the dict implementation to take "string shortcuts" only whenTim Peters2001-09-141-2/+36
| | | | | | | | | | | | | | | | keys are true strings -- no subclasses need apply. This may be debatable. The problem is that a str subclass may very well want to override __eq__ and/or __hash__ (see the new example of case-insensitive strings in test_descr), but go-fast shortcuts for strings are ubiquitous in our dicts (and subclass overrides aren't even looked for then). Another go-fast reason for the change is that PyCheck_StringExact() is a quicker test than PyCheck_String(), and we make such a test on virtually every access to every dict. OTOH, a str subclass may also be perfectly happy using the base str eq and hash, and this change slows them a lot. But those cases are still hypothetical, while Python's own reliance on true-string dicts is not.
* Now that file objects are subclassable, you can get at the file constructorTim Peters2001-09-131-0/+42
| | | | | | just by doing type(f) where f is any file object. This left a hole in restricted execution mode that rexec.py can't plug by itself (although it can plug part of it; the rest is plugged in fileobject.c now).
* Use the keyword form of file() instead of open() to create TESTFN.Tim Peters2001-09-131-2/+2
|
* Added simple tests of keyword arguments in the basic type constructors.Tim Peters2001-09-131-0/+24
|
* type_call(): Change in policy. The keyword args (if any) are now passedTim Peters2001-09-131-2/+13
| | | | | | on to the tp_new slot (if non-NULL), as well as to the tp_init slot (if any). A sane type implementing both tp_new and tp_init should probably pay attention to the arguments in only one of them.
* SF bug [#460467] file objects should be subclassable.Tim Peters2001-09-131-1/+48
| | | | Preliminary support. What's here works, but needs fine-tuning.
* Added subclass equality tests. Almost all of these are commented out now,Tim Peters2001-09-121-0/+11
| | | | because they don't work yet.
* Again perhaps the end of [#460020] bug or feature: unicode() and subclasses.Tim Peters2001-09-121-0/+24
| | | | | Inhibited complex unary plus optimization when applied to a complex subtype. Added PyComplex_CheckExact macro. Some comments and minor code fiddling.
* If interning an instance of a string subclass, intern a real string objectTim Peters2001-09-121-0/+14
| | | | | | with the same value instead. This ensures that a string (or string subclass) object's ob_sinterned pointer is always a str (or NULL), and that the dict of interned strings only has strs as keys.
* str_subtype_new, unicode_subtype_new:Tim Peters2001-09-121-0/+10
| | | | | | | | + These were leaving the hash fields at 0, which all string and unicode routines believe is a legitimate hash code. As a result, hash() applied to str and unicode subclass instances always returned 0, which in turn confused dict operations, etc. + Changed local names "new"; no point to antagonizing C++ compilers.
* More on bug 460020: disable many optimizations of unicode subclasses.Tim Peters2001-09-121-2/+55
|
* More bug 460020: lots of string optimizations inhibited for stringTim Peters2001-09-121-2/+25
| | | | | | | | | subclasses, all "the usual" ones (slicing etc), plus replace, translate, ljust, rjust, center and strip. I don't know how to be sure they've all been caught. Question: Should we complain if someone tries to intern an instance of a string subclass? I hate to slow any code on those paths.
* More bug 460020. Disable a number of long optimizations for long subclasses.Tim Peters2001-09-111-0/+24
|
* More bug 460020: when F is a subclass of float, disable the unary plusTim Peters2001-09-111-0/+1
| | | | optimization (+F(whatever)).
* More bug 460020. When I is a subclass of int, disable the +I(whatever),Tim Peters2001-09-111-0/+5
| | | | | I(0) << whatever, I(0) >> whatever, I(whatever) << 0 and I(whatever) >> 0 optimizations.
* The endless 460020 bug.Tim Peters2001-09-111-0/+9
| | | | Disable t[:], t*0, t*1 optimizations when t is of a tuple subclass type.
* Test for new hmac module.Guido van Rossum2001-09-111-0/+2
|