summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_b1.py
Commit message (Collapse)AuthorAgeFilesLines
* Combine test_b1.py and test_b2.py into test_builtin.py,Walter Dörwald2003-01-191-673/+0
| | | | | | | | port the tests to PyUnit and add many tests for error cases. This increases code coverage in Python/bltinmodule.c from 75% to 92%. (From SF patch #662807, with assert_(not fcmp(x, y)) replaced with assertAlmostEqual(x, y) where possible)
* Change int() so that passing a string, unicode, float or long argumentWalter Dörwald2002-11-191-6/+8
| | | | | | | that is outside the integer range no longer raises OverflowError, but returns a long object instead. This fixes SF bug http://www.python.org/sf/635115
* Whitespace normalization.Tim Peters2002-11-091-13/+13
|
* Make int("...") return a long if an int would overflow.Walter Dörwald2002-11-061-7/+8
| | | | | | Also remove the 512 character limitation for int(u"...") and long(u"..."). This closes SF bug #629989.
* TheTim Peters2002-10-081-1/+1
| | | | | | | | | | | | | | | | list(xrange(sys.maxint / 4)) test. Changed 4 to 2. The belief is that this test intended to trigger a bit of code in listobject.c's NRESIZE macro that's looking for arithmetic overflow. As written, it doesn't achieve that, though, and leaves it up to the platform realloc() as to whether it wants to allocate 2 gigabytes. Some platforms say "sure!", although they don't appear to mean it, and disaster ensues. Changing 4 to 2 (just barely) manages to trigger the arithmetic overflow test instead, leaving the platform realloc() out of it. I'll backport this to the 2.2 branch next.
* The list(xrange(sys.maxint / 4)) test blew up on 64-bit platforms.Guido van Rossum2002-09-111-15/+21
| | | | | | | | Because ob_size is a 32-bit int but sys.maxint is LONG_MAX which is a 64-bit value, there's no way to make this test succeed on a 64-bit platform. So just skip it when sys.maxint isn't 0x7fffffff. Backport candidate.
* complex() was the only numeric constructor that created a new instanceRaymond Hettinger2002-08-291-0/+4
| | | | when given its own type as an argument.
* More changes of DeprecationWarning to FutureWarning.Guido van Rossum2002-08-141-1/+1
|
* Bug #556025: list(xrange(1e9)) --> seg faultJason Tishler2002-08-131-0/+5
| | | | | | | | | Close the bug report again -- this time for Cygwin due to a newlib bug. See the following for the details: http://sources.redhat.com/ml/newlib/2002/msg00369.html Note that this commit is only a documentation (i.e., comment) change.
* Shut up warnings about hex()/oct() that can't be avoided.Guido van Rossum2002-08-121-0/+4
|
* Complete the absolute import patch for the test suite. All relativeBarry Warsaw2002-07-301-1/+1
| | | | | | | | imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed.
* Whitespace normalization.Tim Peters2002-07-161-2/+2
|
* Close SF bug 563740. complex() now finds __complex__() in new style classes.Raymond Hettinger2002-06-061-0/+11
| | | | | Made conversion failure error messages consistent between types. Added related unittests.
* Closes: #556025 seg fault when doing list(xrange(1e9))Neal Norwitz2002-05-221-0/+11
| | | | | | | | | A MemoryError is now raised when the list cannot be created. There is a test, but as the comment says, it really only works for 32 bit systems. I don't know how to improve the test for other systems (ie, 64 bit or systems where the data size != addressable size, e.g. 64 bit data, but 48 bit addressable memory)
* SF bug 543840: complex(string) accepts strings with \0Tim Peters2002-04-141-0/+13
| | | | | | | complex_subtype_from_string(): this stopped parsing at the first 0 byte, as if that were the end of the input string. Bugfix candidate.
* SF patch #523169, by Samuele Pedroni.Guido van Rossum2002-02-261-0/+10
| | | | | | 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.
* SF Patch #494874 add tests for int()/long() invalid parametersNeal Norwitz2001-12-291-0/+23
|
* Ensure that complex() only accepts a string argument as the first arg,Fred Drake2001-12-131-0/+8
| | | | | and only if there is no second arg. This closes SF patch #479551.
* Additional coverage tests by Neil Norwitz.Guido van Rossum2001-12-111-0/+12
| | | | (SF patch #491418, #491420, #491421.)
* The first batch of changes recommended by the fixdiv tool. These areGuido van Rossum2001-09-041-1/+1
| | | | | mostly changes of / operators into //. Once or twice I did more or less than recommended.
* Use raw-unicode-escape for the tests that require it.Martin v. Löwis2001-08-171-2/+2
|
* Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-171-37/+55
| | | | | | | | - Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
* Add tests for getattr() and hasattr() with non-string argsJeremy Hylton2001-07-301-0/+18
|
* SF bug #444510: int() should guarantee truncation.Tim Peters2001-07-261-0/+13
| | | | It's guaranteed now, assuming the platform modf() works correctly.
* SF bug 434186: 0x80000000/2 != 0x80000000>>1Tim Peters2001-06-181-0/+7
| | | | | | | | | i_divmod: New and simpler algorithm. Old one returned gibberish on most boxes when the numerator was -sys.maxint-1. Oddly enough, it worked in the release (not debug) build on Windows, because the compiler optimized away some tricky sign manipulations that were incorrect in this case. Makes you wonder <wink> ... Bugfix candidate.
* OK, changed my mind once more on this. The comparison hierarchy isGuido van Rossum2001-01-221-1/+1
| | | | | | | | | | | | | | now None < all numeric types < all other types so that once again map(max, Squares(3), Squares(2)) equals [0, 1, 4]
* Numeric-smelling objects now once again compare smaller thanGuido van Rossum2001-01-221-1/+1
| | | | non-numeric ones, so 4 < None again in the 'map' test.
* Add test that ensures hash([]) and hash({}) raise TypeError.Guido van Rossum2001-01-181-0/+6
|
* When a PyCFunction that takes only positional parameters is called withFred Drake2001-01-041-0/+11
| | | | | | | | | | an empty keywords dictionary (via apply() or the extended call syntax), the keywords dict should be ignored. If the keywords dict is not empty, TypeError should be raised. (Between the restructuring of the call machinery and this patch, an empty dict in this situation would trigger a SystemError via PyErr_BadInternalCall().) Added regression tests to detect errors for this.
* Numbers no longer compare smaller than all other types. Fix the onlyNeil Schemenauer2001-01-041-1/+2
| | | | part of the testsuite that breaks. The old behavior may be restored.
* Actually call the object with an __call__ method, instead of justJeremy Hylton2001-01-031-0/+1
| | | | | checking if it is callable. This is the only place in the test suite where an __call__ method is called.
* Update the code to better reflect recommended style:Fred Drake2000-12-121-127/+127
| | | | | Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
* This patch adds a new Python C API called PyString_AsStringAndSize()Marc-André Lemburg2000-09-191-0/+12
| | | | | | | | | | | | | which implements the automatic conversion from Unicode to a string object using the default encoding. The new API is then put to use to have eval() and exec accept Unicode objects as code parameter. This closes bugs #110924 and #113890. As side-effect, the traditional C APIs PyString_Size() and PyString_AsString() will also accept Unicode objects as parameters.
* Applying patch #100994 to allow JPython to use more of the standardBarry Warsaw2000-09-011-1/+1
| | | | | | | | | | | | | Python test suite. Specifically, - import time instead of strop in test_b1 - test for ClassType of exceptions using isinstance instead of equality in test_exceptions - remove __builtins__ from dir() output in test_pkg test_pkg output needs to be regenerated.
* style nitsJeremy Hylton2000-08-231-4/+8
|
* Break the cycles after testing cmp() on cyclic objects.Vladimir Marangozov2000-07-141-0/+2
|
* typos fixed by Rob HooftJeremy Hylton2000-06-281-1/+1
|
* Fix PR#7 comparisons of recursive objectsJeremy Hylton2000-04-141-0/+9
| | | | | Note that comparisons of deeply nested objects can still dump core in extreme cases.
* Marc-Andre's third try at this bulk patch seems to work (except thatGuido van Rossum2000-04-051-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | his copy of test_contains.py seems to be broken -- the lines he deleted were already absent). Checkin messages: New Unicode support for int(), float(), complex() and long(). - new APIs PyInt_FromUnicode() and PyLong_FromUnicode() - added support for Unicode to PyFloat_FromString() - new encoding API PyUnicode_EncodeDecimal() which converts Unicode to a decimal char* string (used in the above new APIs) - shortcuts for calls like int(<int object>) and float(<float obj>) - tests for all of the above Unicode compares and contains checks: - comparing Unicode and non-string types now works; TypeErrors are masked, all other errors such as ValueError during Unicode coercion are passed through (note that PyUnicode_Compare does not implement the masking -- PyObject_Compare does this) - contains now works for non-string types too; TypeErrors are masked and 0 returned; all other errors are passed through Better testing support for the standard codecs. Misc minor enhancements, such as an alias dbcs for the mbcs codec. Changes: - PyLong_FromString() now applies the same error checks as does PyInt_FromString(): trailing garbage is reported as error and not longer silently ignored. The only characters which may be trailing the digits are 'L' and 'l' -- these are still silently ignored. - string.ato?() now directly interface to int(), long() and float(). The error strings are now a little different, but the type still remains the same. These functions are now ready to get declared obsolete ;-) - PyNumber_Int() now also does a check for embedded NULL chars in the input string; PyNumber_Long() already did this (and still does) Followed by: Looks like I've gone a step too far there... (and test_contains.py seem to have a bug too). I've changed back to reporting all errors in PyUnicode_Contains() and added a few more test cases to test_contains.py (plus corrected the join() NameError).
* Add tests for float() and complex() with string args (Nick/StephanieGuido van Rossum1999-03-251-0/+2
| | | | Lockwood).
* Added a new test for old filter() memory leakBarry Warsaw1999-01-281-0/+17
|
* Nannified, and re-indented with 4 spaces.Guido van Rossum1998-08-101-88/+88
|
* Improved test set for int() and long() string conversions.Guido van Rossum1998-06-301-0/+59
|
* With the recent change that makes numbers compare smaller than anything,Guido van Rossum1998-06-111-3/+3
| | | | the outcome of the test for max has changed.
* Added tests of the new builtin functions issubclass() and isinstance()Barry Warsaw1997-08-221-0/+36
|
* Fix hex tests for 64-bit machines.Guido van Rossum1997-05-141-1/+3
|
* Added test of complex() (that catches a bug in 1.4!).Guido van Rossum1997-03-311-0/+39
| | | | | Added test that ensures that int() and long() truncate float numbers towards zero.
* updated the hex(-16) test since hex() of a signed literal has changed.Barry Warsaw1997-01-131-1/+1
|
* avoid math, don't abort when overflow check failsGuido van Rossum1995-03-041-1/+5
|
* * Lib/test/test_b1.py: test eval() and execfile() with globals,Guido van Rossum1995-01-021-0/+13
| | | | locals arguments