summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #8567: Fix incorrect precedence of signals in Decimal module.Mark Dickinson2010-05-041-0/+25
| | | | | | | | | | When a Decimal operation raises multiple signals and more than one of those signals is trapped, the specification determines the order in which the signals should be handled. In many cases this order wasn't being followed, leading to the wrong Python exception being raised. This commit fixes those cases, and adds extra tests. The tests are only enabled when EXTENDEDERRORTESTS is True, since they involve rerunning each Decimal testcase several times.
* Fix incorrect use of a list as the target of an 'except' clause in ↵Mark Dickinson2010-05-011-1/+1
| | | | test_decimal.py.
* Use more specific assert* methods in test_decimal.Ezio Melotti2010-04-031-43/+43
|
* Issue 8257: Decimal constructor to accept float.Raymond Hettinger2010-04-021-0/+26
|
* Issue #7279: Make Decimal('nan') hashable. Decimal('snan') remains unhashable.Mark Dickinson2010-04-021-1/+5
| | | | | | Also rewrite the Decimal __hash__ method so that it doesn't rely on float('inf') being valid: float('inf') could raise an exception on platforms not using IEEE 754 arithmetic.
* Issue #7279: Make comparisons involving a Decimal sNaN signal InvalidOperation.Mark Dickinson2010-04-021-8/+47
|
* Issue #2531: Make float-to-decimal comparisons return correct results.Mark Dickinson2010-04-021-0/+26
| | | | | | | Float to decimal comparison operations now return a result based on the numeric values of the operands. Decimal.__hash__ has also been fixed so that Decimal and float values that compare equal have equal hash value.
* Issue #8248: Add some tests for the bool type. Patch by Gregory Nofi.Antoine Pitrou2010-03-301-0/+6
|
* Fix py3k warnings in test_decimal, using unittest.assertItemsEqual.Florent Xicluna2010-03-211-17/+15
|
* Issue #7633: Context method in the decimal module (with the exceptionMark Dickinson2010-02-181-0/+438
| | | | | | of the 'canonical' and 'is_canonical' methods) now consistently accept integer arguments wherever a Decimal instance is accepted. Thanks Juan José Conti for the patch.
* Remove unused imports in test modules.Georg Brandl2010-02-071-1/+0
|
* use assert[Not]IsInstance where appropriateEzio Melotti2010-01-241-2/+2
|
* use assert[Not]In where appropriateEzio Melotti2010-01-231-2/+2
|
* Reverting the Revision: 77368. I committed Flox's big patch for tests bySenthil Kumaran2010-01-081-24/+14
| | | | mistake. ( It may come in for sure tough)
* Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. ↵Senthil Kumaran2010-01-081-14/+24
| | | | Patch by flox
* Issue #7233: A number of two-argument Decimal methods were failing toMark Dickinson2009-10-291-0/+47
| | | | accept ints and longs for the second argument.
* Update decimal test data to the most recent set from Mike Cowlishaw.Mark Dickinson2009-10-081-0/+11
|
* Issue #6857: Fix Decimal formatting to be consistent with existing floatMark Dickinson2009-09-081-1/+2
| | | | formatting: both are now right-aligned by default.
* #Issue 6795: Fix infinite recursion in long(Decimal('nan')); change ↵Mark Dickinson2009-09-071-0/+10
| | | | int(Decimal('nan')) to raise ValueError instead of either returning NaN or raising InvalidContext.
* Issue #6850: Fix bug in Decimal._parse_format_specifier for formatsMark Dickinson2009-09-071-0/+3
| | | | with no type specifier.
* Issue #6595: Allow Decimal constructor to accept non-European decimalMark Dickinson2009-08-021-3/+9
| | | | | digits, as recommended by the specification. (Backport of r74279 from py3k.)
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-46/+46
|
* fix incorrect auto-translation of TestSkipped -> unittest.SkipTestBenjamin Peterson2009-03-261-3/+2
|
* remove test_support.TestSkipped and just use unittest.SkipTestBenjamin Peterson2009-03-261-2/+2
|
* Fix bug in _insert_thousands_sep: too much zero padding could beMark Dickinson2009-03-181-0/+22
| | | | added for 'n' formats with non-repeating thousands-separator.
* Issue #2110: Add support for thousands separator and 'n' format specifierMark Dickinson2009-03-171-1/+97
| | | | to Decimal __format__ method.
* Fix bug in Decimal __format__ method that swapped left and rightMark Dickinson2009-03-171-0/+6
| | | | alignment.
* Register decimals as numbers.NumberRaymond Hettinger2009-02-031-0/+7
|
* Remove an unnecessary check from test_decimal.Mark Dickinson2009-01-101-1/+0
|
* Issue 4796: Add from_float methods to the decimal module.Raymond Hettinger2009-01-031-0/+49
|
* 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.