summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
* - Provisional support for pickling new-style objects. (*)Guido van Rossum2001-09-252-1/+63
| | | | | | | | | | | | | | | | | | | - Made cls.__module__ writable. - Ensure that obj.__dict__ is returned as {}, not None, even upon first reference; it simply springs into life when you ask for it. (*) The pickling support is provisional for the following reasons: - It doesn't support classes with __slots__. - It relies on additional support in copy_reg.py: the C method __reduce__, defined in the object class, really calls calling copy_reg._reduce(obj). Eventually the Python code in copy_reg.py needs to be migrated to C, but I'd like to experiment with the Python implementation first. The _reduce() code also relies on an additional helper function, _reconstructor(), defined in copy_reg.py; this should also be reimplemented in C.
* Set sys.save_stdout (to sys.stdout), so doctest-using tests can be runGuido van Rossum2001-09-251-0/+2
| | | | standalone.
* Change repr() of a new-style class to say <class 'ClassName'> ratherGuido van Rossum2001-09-252-4/+4
| | | | | | than <type 'ClassName'>. Exception: if it's a built-in type or an extension type, continue to call it <type 'ClassName>. Call me a wimp, but I don't want to break more user code than necessary.
* Make __class__ assignment possible, when the object structures are theGuido van Rossum2001-09-251-0/+28
| | | | | | | | | | | | | | same. I hope the test for structural equivalence is stringent enough. It only allows the assignment if the old and new types: - have the same basic size - have the same item size - have the same dict offset - have the same weaklist offset - have the same GC flag bit - have a common base that is the same except for maybe the dict and weaklist (which may have been added separately at the same offsets in both types)
* Make properties discoverable from Python:Tim Peters2001-09-241-2/+28
| | | | | | | | | | | | | - property() now takes 4 keyword arguments: fget, fset, fdel, doc. Note that the real purpose of the 'f' prefix is to make fdel fit in ('del' is a keyword, so can't used as a keyword argument name). - These map to visible readonly attributes 'fget', 'fset', 'fdel', and '__doc__' in the property object. - fget/fset/fdel weren't discoverable from Python before. - __doc__ is new, and allows to associate a docstring with a property.
* Added several new tests to check the behavior with respect to doctypeFred Drake2001-09-241-6/+77
| | | | | | | declarations and weird markup that we used to accept & ignore that recent versions raised an exception for; the original behavior has been restored and augmented (the user can decide what to do if they care; the default is to ignore it as done in early versions).
* Adapt to use the test_main() approach.Fred Drake2001-09-241-1/+6
|
* Another comparison patch-up: comparing a type with a dynamic metatypeGuido van Rossum2001-09-241-0/+7
| | | | to one with a static metatype raised an obscure error.
* Add more tests showing the relationship between exceptions raised & caughtFred Drake2001-09-241-9/+64
| | | | and the information provided to the profiler. This stuff is a mess!
* Do the same thing to complex that I did to str: the rich comparisonGuido van Rossum2001-09-241-0/+15
| | | | | function returns NotImplemented when comparing objects whose tp_richcompare slot is not itself.
* StringIO patch #462596: let's [c]StringIO accept read buffers onMarc-André Lemburg2001-09-241-8/+23
| | | | input to .write() too.
* Change string comparison so that it applies even when one (or both)Guido van Rossum2001-09-241-6/+6
| | | | | arguments are subclasses of str, as long as they don't override rich comparison.
* Fix the baffler that Tim reported: sometimes the repr() of an objectGuido van Rossum2001-09-241-2/+2
| | | | | looks like <X object at ...>, sometimes it says <X instance at ...>. Make this uniformly say <X object at ...>.
* Generalize file.writelines() to allow iterable objects.Tim Peters2001-09-231-0/+53
|
* The test data (mostly example messages) for the email package testBarry Warsaw2001-09-2316-0/+643
| | | | suite. Note that other tests can put input data in this directory.
* An extensive test suite for the email package.Barry Warsaw2001-09-231-0/+797
|
* New function classify_class_attrs(). As a number of SF bug reportsTim Peters2001-09-231-0/+201
| | | | | | | | | | | | | | | | | | | point out, pydoc doesn't tell you where class attributes were defined, gets several new 2.2 features wrong, and isn't aware of some new features checked in on Thursday <wink>. pydoc is hampered in part because inspect.py has the same limitations. Alas, I can't think of a way to fix this within the current architecture of inspect/pydoc: it's simply not possible in 2.2 to figure out everything needed just from examining the object you get back from class.attr. You also need the class context, and the method resolution order, and tests against various things that simply didn't exist before. OTOH, knowledge of how to do that is getting quite complex, so doesn't belong in pydoc. classify_class_attrs takes a different approach, analyzing all the class attrs "at once", and returning the most interesting stuff for each, all in one gulp. pydoc needs to be reworked to use this for classes (instead of the current "filter dir(class) umpteen times against assorted predicates" approach).
* Add a function to compute a class's method resolution order. This isTim Peters2001-09-221-0/+20
| | | | | | easy for 2.2 new-style classes, but trickier for classic classes, and different approaches are needed "depending". The function will allow later code to treat all flavors of classes uniformly.
* Since the most likely failure mode for an expected-output test is a changeTim Peters2001-09-221-15/+22
| | | | | | | somewhere inside a line, use ndiff so that intraline difference marking can point out what changed within a line. I don't remember diff-style abbreviations either (haven't used it since '94, except to produce patches), so say the rest in English too.
* Converted test_StringIO.py to use unittest, soBarry Warsaw2001-09-222-62/+71
| | | | | | | 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.
* Start of a test to make sure the profiler/tracer support in the coreFred Drake2001-09-221-0/+110
| | | | interpreter is reporting what we expect to see.
* Add the __getattr__ hook back. The rules are now:Guido van Rossum2001-09-211-5/+4
| | | | | | | - if __getattribute__ exists, it is called first; if it doesn't exists, PyObject_GenericGetAttr is called first. - if the above raises AttributeError, and __getattr__ exists, it is called.
* reportdiff(): print a "plain diff" style diff.Guido van Rossum2001-09-211-4/+30
| | | | XXX This should really be a unified diff, but I can't be bothered.
* Oops. I didn't expect that some tests (test_cookie) have expectedGuido van Rossum2001-09-212-9/+3
| | | | | output *and* doctest stuff. Assuming the doctest stuff comes after the expected output, this fixes that.
* Change the way unexpected output is reported: rather than stopping atGuido van Rossum2001-09-212-94/+52
| | | | | | | | | | the first difference, let the test run till completion, then gather all the output and compare it to the expected output using difflib. XXX Still to do: produce diff output that only shows the sections that differ; currently it produces ndiff-style output because that's the easiest to produce with difflib, but this becomes a liability when the output is voluminous and there are only a few differences.
* Change the name of the __getattr__ special method for new-styleGuido van Rossum2001-09-212-7/+7
| | | | | | | | classes to __getattribute__, to make it crystal-clear that it doesn't have the same semantics as overriding __getattr__ on classic classes. This is a halfway checkin -- I'll proceed to add a __getattr__ hook that works the way it works in classic classes.
* 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
|