summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
Commit message (Collapse)AuthorAgeFilesLines
* Merged revisions 75286 via svnmerge fromMark Dickinson2009-10-271-0/+11
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r75286 | mark.dickinson | 2009-10-08 17:28:39 +0100 (Thu, 08 Oct 2009) | 2 lines Update decimal test data to the most recent set from Mike Cowlishaw. ........
* Merged revisions 74708 via svnmerge fromMark Dickinson2009-09-081-0/+10
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74708 | mark.dickinson | 2009-09-07 19:04:58 +0100 (Mon, 07 Sep 2009) | 2 lines #Issue 6795: Fix infinite recursion in long(Decimal('nan')); change int(Decimal('nan')) to raise ValueError instead of either returning NaN or raising InvalidContext. ........
* Merged revisions 74704 via svnmerge fromMark Dickinson2009-09-071-0/+3
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74704 | mark.dickinson | 2009-09-07 17:17:41 +0100 (Mon, 07 Sep 2009) | 3 lines Issue #6850: Fix bug in Decimal._parse_format_specifier for formats with no type specifier. ........
* Merged revisions 74281 via svnmerge fromMark Dickinson2009-08-021-3/+9
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r74281 | mark.dickinson | 2009-08-02 11:59:36 +0100 (Sun, 02 Aug 2009) | 4 lines Issue #6595: Allow Decimal constructor to accept non-European decimal digits, as recommended by the specification. (Backport of r74279 from py3k.) ........
* Merged revisions 70430 via svnmerge fromMark Dickinson2009-03-171-0/+6
| | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r70430 | mark.dickinson | 2009-03-17 18:01:03 +0000 (Tue, 17 Mar 2009) | 3 lines Fix bug in Decimal __format__ method that swapped left and right alignment. ........
* Register decimals as numbers.NumberRaymond Hettinger2009-02-031-0/+7
|
* Merged revisions ↵Georg Brandl2009-01-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r68292 | skip.montanaro | 2009-01-04 11:36:58 +0100 (So, 04 Jan 2009) | 3 lines If user configures --without-gcc give preference to $CC instead of blindly assuming the compiler will be "cc". ........ r68344 | marc-andre.lemburg | 2009-01-05 20:43:35 +0100 (Mo, 05 Jan 2009) | 7 lines Fix #4846 (Py_UNICODE_ISSPACE causes linker error) by moving the declaration into the extern "C" section. Add a few more comments and apply some minor edits to make the file contents fit the original structure again. ........ r68361 | antoine.pitrou | 2009-01-06 19:34:08 +0100 (Di, 06 Jan 2009) | 3 lines Use shutil.rmtree rather than os.rmdir. ........ r68378 | mark.dickinson | 2009-01-07 18:48:33 +0100 (Mi, 07 Jan 2009) | 2 lines Issue #4869: clarify documentation for random.expovariate. ........ r68424 | benjamin.peterson | 2009-01-09 03:53:35 +0100 (Fr, 09 Jan 2009) | 1 line specify what -3 warnings are about ........ r68426 | benjamin.peterson | 2009-01-09 04:03:05 +0100 (Fr, 09 Jan 2009) | 1 line fix spelling ........ r68429 | benjamin.peterson | 2009-01-09 04:05:14 +0100 (Fr, 09 Jan 2009) | 1 line add -3 to manpage ........ r68430 | benjamin.peterson | 2009-01-09 04:07:27 +0100 (Fr, 09 Jan 2009) | 1 line be more specific in -3 option help ........ r68450 | jeffrey.yasskin | 2009-01-09 17:47:07 +0100 (Fr, 09 Jan 2009) | 3 lines Fix issue 4884, preventing a crash in the socket code when python is compiled with llvm-gcc and run with a glibc <2.10. ........ r68457 | kristjan.jonsson | 2009-01-09 21:10:59 +0100 (Fr, 09 Jan 2009) | 1 line Issue 3677: Fix import from UNC paths on Windows. ........ r68480 | vinay.sajip | 2009-01-10 14:38:04 +0100 (Sa, 10 Jan 2009) | 1 line Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library. ........ r68481 | vinay.sajip | 2009-01-10 14:42:04 +0100 (Sa, 10 Jan 2009) | 1 line Corrected an incorrect self-reference. ........ r68493 | benjamin.peterson | 2009-01-10 18:18:55 +0100 (Sa, 10 Jan 2009) | 1 line rewrite verbose conditionals ........ r68495 | benjamin.peterson | 2009-01-10 18:36:44 +0100 (Sa, 10 Jan 2009) | 1 line tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901 ........ r68499 | mark.dickinson | 2009-01-10 20:14:55 +0100 (Sa, 10 Jan 2009) | 2 lines Remove an unnecessary check from test_decimal. ........ r68501 | vinay.sajip | 2009-01-10 20:22:57 +0100 (Sa, 10 Jan 2009) | 1 line Corrected minor typo and added .currentmodule directives to fix missing cross-references. ........ r68512 | benjamin.peterson | 2009-01-10 23:42:10 +0100 (Sa, 10 Jan 2009) | 1 line make tests fail if they can't be imported ........ r68514 | benjamin.peterson | 2009-01-11 00:41:59 +0100 (So, 11 Jan 2009) | 1 line move seealso to a more appropiate place ........ r68515 | benjamin.peterson | 2009-01-11 00:49:08 +0100 (So, 11 Jan 2009) | 1 line macos 9 isn't supported ........
* Replace occurrences of '\d' with '[0-9]' in Decimal regex, to make sureMark Dickinson2008-07-021-0/+3
| | | | | | | | that the behaviour of Decimal doesn't change if/when re.UNICODE becomes assumed in Python 3.0. Also add a check that alternative Unicode digits (e.g. u'\N{FULLWIDTH DIGIT ONE}') are *not* accepted in a numeric string.
* Fixed some test structures. Thanks Mark Dickinson.Facundo Batista2008-05-021-16/+9
|
* Remove some from __future__ import with_statementsBenjamin Peterson2008-04-301-1/+0
|
* Issue #2482: Make sure that the coefficient of a DecimalMark Dickinson2008-03-251-0/+16
| | | | | instance is always stored as a str instance, even when that Decimal has been created from a unicode string.
* Issue #2478: Decimal(sqrt(0)) failed when the decimal contextMark Dickinson2008-03-251-0/+6
| | | | was not explicitly supplied.
* Small fix that complicated the test actually when thatFacundo Batista2008-03-221-4/+10
| | | | test failed.
* Add __format__ method to Decimal, to support PEP 3101Mark Dickinson2008-02-291-0/+93
|
* Fix decimal repr which should have used single quotes like other reprs.Raymond Hettinger2008-02-141-1/+1
|
* Issue 1979: Make Decimal comparisons (other than !=, ==) involving NaNMark Dickinson2008-02-061-1/+19
| | | | raise InvalidOperation (and return False if InvalidOperation is trapped).
* Move __builtins__.trunc() to math.trunc() perJeffrey Yasskin2008-02-011-2/+3
| | | | | http://mail.python.org/pipermail/python-dev/2008-January/076626.html and issue 1965.
* Add support for trunc().Raymond Hettinger2008-01-241-0/+11
|
* Issue 1780: Allow leading and trailing whitespace in Decimal constructor,Mark Dickinson2008-01-121-0/+8
| | | | | when constructing from a string. Disallow trailing newlines in Context.create_decimal.
* Issue #1757: The hash of a Decimal instance is no longer affectedFacundo Batista2008-01-081-0/+17
| | | | by the current context. Thanks Mark Dickinson.
* Major change in the internal structure of the DecimalFacundo Batista2007-11-231-0/+1
| | | | | | | | | | number: now it does not store the mantissa as a tuple of numbers, but as a string. This avoids a lot of conversions, and achieves a speedup of 40%. The API remains intact. Thanks Mark Dickinson.
* The constructor from tuple was way too permissive: it allowed badFacundo Batista2007-10-191-0/+27
| | | | | | | | coefficient numbers, floats in the sign, and other details that generated directly the wrong number in the best case, or triggered misfunctionality in the alorithms. Test cases added for these issues. Thanks Mark Dickinson.
* Made the various is_* operations return booleans. This was discussedFacundo Batista2007-10-021-13/+39
| | | | | | | | | | | with Cawlishaw by mail, and he basically confirmed that to these is_* operations, there's no need to return Decimal(0) and Decimal(1) if the language supports the False and True booleans. Also added a few tests for the these functions in extra.decTest, since they are mostly untested (apart from the doctests). Thanks Mark Dickinson
* Issue #1772851. Optimization of __hash__ to behave better for big bigFacundo Batista2007-09-191-0/+32
| | | | numbers.
* Fix obvious typo in threaded test.Thomas Wouters2007-09-191-1/+1
|
* The methods always return Decimal classes, even if they'reFacundo Batista2007-09-171-0/+15
| | | | | executed through a subclass (thanks Mark Dickinson). Added a bit of testing for this.
* Merged the decimal-branch (revisions 54886 to 58140). Decimal is nowFacundo Batista2007-09-131-48/+170
| | | | | | | fully updated to the latests Decimal Specification (v1.66) and the latests test cases (v2.56). Thanks to Mark Dickinson for all his help during this process.
* Make decimal.ContextManager a private implementation detail of ↵Nick Coghlan2006-09-021-13/+2
| | | | decimal.localcontext()
* Fix the wrongheaded implementation of context management in the decimal ↵Nick Coghlan2006-08-311-0/+39
| | | | module and add unit tests. (python-dev discussion is ongoing regarding what we do about Python 2.5)
* Fix tests so they pass in -R modeNeal Norwitz2006-04-091-5/+8
|
* test_main(): Restore the decimal context that was inTim Peters2006-03-311-10/+14
| | | | | | | | effect at the time test_decimal was imported. Else running test_decimal had the bad side effect of permanently changing the decimal context in effect. That caused text_tokenize to fail if it ran after test_decimal.
* whitespace normalisationAnthony Baxter2006-03-301-1/+1
|
* Make test_decimal work with -Qnew.Georg Brandl2006-03-281-10/+16
|
* * Fix decimal's handling of foreign types. Now returns NotImplementedRaymond Hettinger2005-03-271-7/+50
| | | | | | | instead of raising a TypeError. Allows other types to successfully implement __radd__() style methods. * Remove future division import from test suite. * Remove test suite's shadowing of __builtin__.dir().
* Bug #1163325: "special" decimals aren't hashableRaymond Hettinger2005-03-151-0/+3
|
* Bug #1083645Raymond Hettinger2004-12-181-2/+12
| | | | * The decimal module wouldn't load on builds without threads.
* SF bug #1071588 coercing decimal to int doesn't work between -1 and 1Raymond Hettinger2004-11-241-4/+4
|
* Change the strategy for coping with time intensive tests fromRaymond Hettinger2004-09-041-7/+12
| | | | | | | | "all or none" to "all or some". This provides much greater test coverage without eating much time. It also makes it more likely that routine regression testing will unearth bugs.
* There are no longer any special case test skips.Raymond Hettinger2004-08-171-3/+0
|
* * Dynamically build a list of files to be tested (necessary becauseRaymond Hettinger2004-08-171-81/+14
| | | | | | | version 2.39 of dectest.zip adds some new test files and because some existing test files were getting skipped). * Remove two docstrings which cluttered unittest's output. * Simplify a for-loop with a list comprehension.
* Add a test for Context.copy().Raymond Hettinger2004-08-081-0/+8
|
* * Hide a loop induction variable that was inadvertantly being picked upRaymond Hettinger2004-07-141-28/+0
| | | | | | | by the locals() call in the context constructor. * Remove unnecessary properties for int, exp, and sign which duplicated information returned by as_tuple().
* * Rename "Signals" to "_signals" making it non-public.Raymond Hettinger2004-07-141-1/+7
| | | | | * Context.create_decimal can take a zero default just like Decimal(). * Fix typo in comment.
* Improve Context construction and representation:Raymond Hettinger2004-07-101-16/+12
| | | | | | | | | | | | | * Rename "trap_enablers" to just "traps". * Simplify names of "settraps" and "setflags" to just "traps" and "flags". * Show "capitals" in the context representation * Simplify the Context constructor to match its repr form so that only the set flags and traps need to be listed. * Representation can now be run through eval(). Improve the error message when the Decimal constructor is given a float. The test suite no longer needs a duplicate reset_flags method.
* * Update the test suite to reflect that ConversionSyntax was no longerRaymond Hettinger2004-07-091-2/+2
| | | | | | | | public. * Removed the non-signal conditions from __all__. * Removed the XXX comment which was resolved. * Use ^ instead of operator.xor * Remove the threading lock which is no longer necessary.
* Module and tests:Raymond Hettinger2004-07-091-6/+5
| | | | | | | | | | | | * Map conditions to related signals. * Make contexts unhashable. * Eliminate used "default" attribute in exception definitions. * Eliminate the _filterfunc in favor of a straight list. Docs: * Eliminate documented references to conditions that are not signals. * Eliminate parenthetical notes such as "1/0 --> Inf" which are no longer true with the new defaults.
* * Add __eq__ and __ne__ so that things like list.index() work properlyRaymond Hettinger2004-07-051-11/+16
| | | | | for lists of mixed types. * Test that sort works.
* Test the logic for int(d).Raymond Hettinger2004-07-051-0/+10
|
* * Make the tests independent of the default precision.Raymond Hettinger2004-07-031-0/+7
| | | | * Change the default precision to 28 (to match VB's decimal type).
* Work through several open todos:Raymond Hettinger2004-07-031-7/+23
| | | | | | | | | | | | | | | | | * Added test for pickling contexts * Renamed ExceptionList to Signals (to match wording in the spec) * Simplified Context constructor by allowing flags=None to automatically generate a zeroed-out flags dictionary. * inlined _convertString() which was used only once * _rounding_decision is private, so excluded its contants from __all__. * added an XXX comment with concerns about subclassing signals results in a deviation from the spec (maybe important, maybe not). * Taught the test_suite to determine its own directory (modeled after code in regrtest.py). Enables it to be run when the current directory is not the test directory. * Added a clear_flags() method to the Context API to make it easier to do a common operation with flags. * Fixed the trap_enablers defaults in BasicDefaultContext to match the spec.