summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40928: notify users running test_decimal on macOS of malloc warnings ↵Miss Islington (bot)2021-08-061-1/+6
| | | | | | | | | | | (GH-26783) * When trying to allocate very large regions on macOS, malloc does not fail silently. It sends a noisy error out to STDERR * This provides a helper function to warn the user, and provides the warning for test_decimal, which consistently generates these warnings on macOS. Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 15d3c14df32a35ac69898a7852115722e30d7857) Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
* bpo-43475: Fix the Python implementation of hash of Decimal NaN (GH-26679)Miss Islington (bot)2021-06-131-8/+15
| | | | | (cherry picked from commit 9f1c5f6e8af6ba3f659b2aea1e221ac9695828ba) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)Inada Naoki2021-04-041-1/+1
| | | | | | | | | | | | | | | | | | | * test_asyncio * test_bz2 * test_math * test_cmath * test_cmd_line * test_cmd_line_script * test_compile * test_contextlib * test_profile * ctypes/test/test_find * test_multiprocessing * test_configparser * test_csv * test_dbm_dumb * test_decimal * test_difflib * os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
* bpo-43422: Revert _decimal C API addition (GH-24960)Antoine Pitrou2021-03-211-176/+0
| | | | | | | | | Stefan Krah requested the reversal of these (unreleased) changes, quoting him: > The capsule API does not meet my testing standards, since I've focused on the upstream mpdecimal in the last couple of months. > Additionally, I'd like to refine the API, perhaps together with the Arrow community. Automerge-Triggered-By: GH:pitrou
* Revert "bpo-26680: Incorporate is_integer in all built-in and standard ↵Raymond Hettinger2020-10-071-24/+0
| | | | | library numeric types (GH-6121)" (GH-22584) This reverts commit 58a7da9e125422323f79c4ee95ac5549989d8162.
* bpo-26680: Incorporate is_integer in all built-in and standard library ↵Robert Smallshire2020-10-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | numeric types (GH-6121) * bpo-26680: Adds support for int.is_integer() for compatibility with float.is_integer(). The int.is_integer() method always returns True. * bpo-26680: Adds a test to ensure that False.is_integer() and True.is_integer() are always True. * bpo-26680: Adds Real.is_integer() with a trivial implementation using conversion to int. This default implementation is intended to reduce the workload for subclass implementers. It is not robust in the presence of infinities or NaNs and may have suboptimal performance for other types. * bpo-26680: Adds Rational.is_integer which returns True if the denominator is one. This implementation assumes the Rational is represented in it's lowest form, as required by the class docstring. * bpo-26680: Adds Integral.is_integer which always returns True. * bpo-26680: Adds tests for Fraction.is_integer called as an instance method. The tests for the Rational abstract base class use an unbound method to sidestep the inability to directly instantiate Rational. These tests check that everything works correct as an instance method. * bpo-26680: Updates documentation for Real.is_integer and built-ins int and float. The call x.is_integer() is now listed in the table of operations which apply to all numeric types except complex, with a reference to the full documentation for Real.is_integer(). Mention of is_integer() has been removed from the section 'Additional Methods on Float'. The documentation for Real.is_integer() describes its purpose, and mentions that it should be overridden for performance reasons, or to handle special values like NaN. * bpo-26680: Adds Decimal.is_integer to the Python and C implementations. The C implementation of Decimal already implements and uses mpd_isinteger internally, we just expose the existing function to Python. The Python implementation uses internal conversion to integer using to_integral_value(). In both cases, the corresponding context methods are also implemented. Tests and documentation are included. * bpo-26680: Updates the ACKS file. * bpo-26680: NEWS entries for int, the numeric ABCs and Decimal. Co-authored-by: Robert Smallshire <rob@sixty-north.com>
* bpo-41540: AIX: skip test that is flaky with a default ulimit. (#21890)Stefan Krah2020-08-151-0/+3
| | | | - AIX has extreme over-allocation that is in no relation to the physical RAM and swap.
* bpo-41324 Add a minimal decimal capsule API (#21519)Stefan Krah2020-08-101-0/+176
|
* bpo-41338: Fix DeprecationWarning in tests (GH-21542)Inada Naoki2020-07-201-0/+3
|
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-101-1/+4
| | | | Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
* bpo-40275: Use new test.support helper submodules in tests (GH-20849)Hai Shi2020-06-251-1/+2
|
* Fix missing FloatOperation in EXTRA_FUNCTIONALITY path. (#20655)Stefan Krah2020-06-051-0/+2
|
* bpo-39576: Prevent memory error for overly optimistic precisions (GH-18581)Stefan Krah2020-02-211-0/+35
|
* Remove binding of captured exceptions when not used to reduce the chances of ↵Pablo Galindo2019-11-191-2/+2
| | | | | | | creating cycles (GH-17246) Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles. See for example GH-13135
* bpo-35133: Fix mistakes when concatenate string literals on different lines. ↵Serhiy Storchaka2018-11-051-2/+2
| | | | | | | | | | (GH-10284) Two kind of mistakes: 1. Missed space. After concatenating there is no space between words. 2. Missed comma. Causes unintentional concatenating in a list of strings.
* bpo-33750: Reset thread-local context precision in test_round(). (#7355)Stefan Krah2018-06-031-11/+11
|
* bpo-31234: Join threads in tests (#3572)Victor Stinner2017-09-141-0/+3
| | | | Call thread.join() on threads to prevent the "dangling threads" warning.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-6/+3
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-29919: Remove unused imports found by pyflakes (#137)Victor Stinner2017-03-271-2/+1
| | | Make also minor PEP8 coding style fixes on modified imports.
* Fixed #29534 - _decimal difference with _pydecimal (#65)Andrew Nester2017-02-141-0/+10
|
* Remove unused imports.Serhiy Storchaka2016-12-161-2/+0
|
* Issue #26331: Implement the parsing part of PEP 515.Brett Cannon2016-09-091-0/+10
| | | | Thanks to Georg Brandl for the patch.
* Merge 3.5.Stefan Krah2016-07-171-0/+28
|\
| * Issue #26974: Fix segfault in the presence of absurd subclassing. ProactivelyStefan Krah2016-07-171-0/+28
| | | | | | | | eliminate all internal uses of overridden methods.
* | Merge 3.5.Stefan Krah2016-06-201-1/+4
|\ \ | |/
| * Issue #27006: from_float(): call the subclass' __new__() and __init__().Stefan Krah2016-06-201-1/+4
| |
| * Issue #26621: Remove unnecessary test.Stefan Krah2016-03-231-1/+0
| |
* | Issue #26621: Update libmpdec version and remove unnecessary test case.Stefan Krah2016-03-231-1/+0
| |
* | Issue #25928: Add Decimal.as_integer_ratio(). Python parts and docs byStefan Krah2015-12-281-0/+33
|/ | | | Mark Dickinson.
* Issue #22777: Test pickling with all protocols.Serhiy Storchaka2014-12-151-96/+98
|\
| * Issue #22777: Test pickling with all protocols.Serhiy Storchaka2014-12-151-96/+98
| |
* | Issue #19232: Speed up decimal import. Additionally, since _decimal isStefan Krah2014-09-101-3/+1
| | | | | | | | | | self-contained, this change facilitates maintenance and the Python version can be easily imported for experimentation.
* | Merge 3.4.Stefan Krah2014-08-261-0/+5
|\ \ | |/
| * Issue #22090: Fix '%' formatting for infinities and NaNs.Stefan Krah2014-08-261-0/+5
| |
* | Issue #18492: Merge with 3.4Zachary Ware2014-06-021-2/+2
|\ \ | |/
| * Issue #18492: Allow all resources when tests are not run by regrtest.py.Zachary Ware2014-06-021-2/+2
| | | | | | | | This changeset also includes cleanup allowed by this behavior change.
| * Issue #21374: Fix pickling of DecimalTuple.Stefan Krah2014-04-291-0/+17
| |
* | Fix typo and tests without docstrings.Stefan Krah2014-05-011-2/+3
| |
* | Issue #21407: _decimal now supports function signatures.Stefan Krah2014-05-011-0/+138
| |
* | Issue #10650: Remove the non-standard 'watchexp' parameter from theStefan Krah2014-04-301-12/+0
| | | | | | | | | | Decimal.quantize() method in the Python version. It had never been present in the C version.
* | Issue #21374: Fix pickling of DecimalTuple.Stefan Krah2014-04-291-0/+17
|/
* Avoid UnicodeEncodeError by only printing ASCII.Zachary Ware2013-12-121-2/+2
| | | | | This fixes running test_decimal in verbose mode on Windows, which I broke in issue #19572.
* Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-11/+8
|
* 1) Prepare libmpdec for the 2.4.0 release. None of the following changes ↵Stefan Krah2013-11-241-0/+1
| | | | | | | | | | | | | | | | | | affects _decimal: o Make all "mpd_t to C integer" conversion functions available in both the 64-bit and the 32-bit versions. o Make all mixed mpd_t/C integer arithmetic functions available in the 32-bit version. o Better handling of __STDC_LIMIT_MACROS for C++ users. o Add struct tags (at the request of C++ users). 2) Check for libmpdec.so.2 if --with-system-libmpdec is used.
* Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-1/+1
| | | | error messages and comments.
* Backport bff16086f03b and bcaaaa00425b.Stefan Krah2013-05-291-0/+13
|
* Issue #17768: Support newline fill character in decimal.py and NUL fillStefan Krah2013-05-291-0/+4
| | | | character in _decimal.c.
* Issue #17047: remove doubled words added in 3.3Terry Jan Reedy2013-03-111-1/+1
| | | | as reported by Serhiy Storchaka and Matthew Barnett.
* Since the return type of format() is not a Decimal, raise ValueError instead ofStefan Krah2013-01-241-10/+4
| | | | | InvalidOperation if the format specification (width, prec) exceeds the internal limits of libmpdec.
* Issue #16422: Use strings for rounding mode constants for better readabilityStefan Krah2013-01-161-65/+54
| | | | and pickling compatibility.