summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_long.py
Commit message (Collapse)AuthorAgeFilesLines
* Moved testing of builtin types out of test_builtin and into type specific ↵Benjamin Peterson2008-05-031-2/+249
| | | | modules
* Continue rolling back pep-3141 changes that changed behavior from 2.5. ThisJeffrey Yasskin2008-01-051-3/+1
| | | | | | | | | | | | round included: * Revert round to its 2.6 behavior (half away from 0). * Because round, floor, and ceil always return float again, it's no longer necessary to have them delegate to __xxx___, so I've ripped that out of their implementations and the Real ABC. This also helps in implementing types that work in both 2.6 and 3.0: you return int from the __xxx__ methods, and let it get enabled by the version upgrade. * Make pow(-1, .5) raise a ValueError again.
* Bug #1481296: Fixed long(float('nan'))!=0L.Christian Heimes2008-01-041-0/+4
|
* Backport PEP 3141 from the py3k branch to the trunk. This includes r50877 (justJeffrey Yasskin2008-01-031-1/+3
| | | | | | | the complex_pow part), r56649, r56652, r56715, r57296, r57302, r57359, r57361, r57372, r57738, r57739, r58017, r58039, r58040, and r59390, and new documentation. The only significant difference is that round(x) returns a float to preserve backward-compatibility. See http://bugs.python.org/issue1689.
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-3/+20
| | | | | | | | | | | | | | | | | | | | | | | * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests...
* SF bug #1224347: int/long unification and hex()Raymond Hettinger2005-06-291-1/+1
| | | | Hex longs now print with lowercase letters like their int counterparts.
* Port test_long.py to unittest.Walter Dörwald2005-06-131-508/+451
|
* SF bug #513866: Float/long comparison anomaly.Tim Peters2004-09-231-2/+102
| | | | | | | | | | | | | | | | | | When an integer is compared to a float now, the int isn't coerced to float. This avoids spurious overflow exceptions and insane results. This should compute correct results, without raising spurious exceptions, in all cases now -- although I expect that what happens when an int/long is compared to a NaN is still a platform accident. Note that we had potential problems here even with "short" ints, on boxes where sizeof(long)==8. There's #ifdef'ed code here to handle that, but I can't test it as intended. I tested it by changing the #ifdef to trigger on my 32-bit box instead. I suppose this is a bugfix candidate, but I won't backport it. It's long-winded (for speed) and messy (because the problem is messy). Note that this also depends on a previous 2.4 patch that introduced _Py_SwappedOp[] as an extern.
* Changed Karatsuba cutoff to match current reality.Tim Peters2004-08-301-1/+1
|
* test_float_overflow(): make shuge (added last week) a little lessGuido van Rossum2003-02-031-1/+1
| | | | | | | | | huge. On older Linux systems, the C library's strtod() apparently gives up before seeing the end of the string when it sees so many digits that it thinks the result must be Infinity. (It is wrong, BTW -- there could be an "e-10000" hiding behind 10,000 digits.) The shorter shuge still tests what it's testing, without relying on strtod() doing a super job.
* Fix SF bug# 676155, RuntimeWarning with tp_compareNeal Norwitz2003-01-281-2/+4
| | | | Check return value of PyLong_AsDouble(), it can return an error.
* Change int() so that passing a string, unicode, float or long argumentWalter Dörwald2002-11-191-10/+14
| | | | | | | 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
* Added a test specifically to tickle Karatsuba; it costs no appreciableTim Peters2002-08-131-0/+26
| | | | runtime.
* test_division(): Added one larger digits value, to ensure that theTim Peters2002-08-131-1/+2
| | | | "lopsided Karatsuba" driver also gets some exercise.
* Machines-- and Python --are a lot faster in relevant ways since thisTim Peters2002-08-131-3/+5
| | | | | | test was written. So boosted the number of "digits" this generates, and also beefed up the "* / divmod" test to tickle numbers big enough to trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Format strings (tuples,) appropriatelyNeal Norwitz2002-04-011-1/+1
|
* Return reasonable results for math.log(long) and math.log10(long) (we wereTim Peters2001-09-051-3/+37
| | | | | | getting Infs, NaNs, or nonsense in 2.1 and before; in yesterday's CVS we were getting OverflowError; but these functions always make good sense for positive arguments, no matter how large).
* Revert one of the "division fixes" in test_long. It intends to try bothTim Peters2001-09-041-2/+2
| | | | | | "/" and "//", and doesn't really care what they *mean*, just that both are tried (and that, whatever they mean, they act similarly for int and long arguments).
* The first batch of changes recommended by the fixdiv tool. These areGuido van Rossum2001-09-041-5/+5
| | | | | mostly changes of / operators into //. Once or twice I did more or less than recommended.
* Whitespace normalization.Tim Peters2001-09-041-1/+1
|
* Raise OverflowError when appropriate on long->float conversion. Most ofTim Peters2001-09-041-0/+37
| | | | | | | the fiddling is simply due to that no caller of PyLong_AsDouble ever checked for failure (so that's fixing old bugs). PyLong_AsDouble is much faster for big inputs now too, but that's more of a happy consequence than a design goal.
* New restriction on pow(x, y, z): If z is not None, x and y must be ofTim Peters2001-09-031-4/+13
| | | | | 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
* Add a test for the new // operator too.Tim Peters2001-08-231-0/+4
|
* SF bug [#454456] int overflow code needs tests.Tim Peters2001-08-231-0/+61
| | | | | Added tests for boundary cases in magical PEP 237 int->long auto-overflow, but nothing here addresses the rest of the bug report so left it open.
* Remove test_long's expected-output file.Tim Peters2001-08-231-4/+8
|
* This patch removes all uses of "assert" in the regression test suiteMarc-André Lemburg2001-01-171-4/+4
| | | | | | | and replaces them with a new API verify(). As a result the regression suite will also perform its tests in optimization mode. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Make reindent.py happy (convert everything to 4-space indents!).Fred Drake2000-10-231-1/+0
|
* Christian Tismer: added test to ensure that multiplication commutes.Guido van Rossum2000-04-101-0/+2
| | | | | | [The test is in a slightly odd place, in test_division_2; but it exercises the recent change to long_mult(), and that's all we really ask for. --GvR]
* Revise tests to support str(<long int object>) not appending "L".Fred Drake1999-12-231-2/+8
|
* New test_long.py from Tim Peters.Guido van Rossum1998-10-021-11/+124
|
* Add Tim Peters' test for long intsGuido van Rossum1998-08-131-0/+139