|
34 | 34 | import locale |
35 | 35 | from test.support import (is_resource_enabled, |
36 | 36 | requires_IEEE_754, requires_docstrings, |
37 | | - requires_legacy_unicode_capi, check_sanitizer) |
| 37 | + check_disallow_instantiation) |
38 | 38 | from test.support import (TestFailed, |
39 | 39 | run_with_locale, cpython_only, |
40 | | - darwin_malloc_err_warning, is_emscripten) |
| 40 | + darwin_malloc_err_warning) |
41 | 41 | from test.support.import_helper import import_fresh_module |
42 | 42 | from test.support import threading_helper |
43 | 43 | from test.support import warnings_helper |
@@ -586,18 +586,6 @@ def test_explicit_from_string(self): |
586 | 586 | # underscores don't prevent errors |
587 | 587 | self.assertRaises(InvalidOperation, Decimal, "1_2_\u00003") |
588 | 588 |
|
589 | | - @cpython_only |
590 | | - @requires_legacy_unicode_capi() |
591 | | - @warnings_helper.ignore_warnings(category=DeprecationWarning) |
592 | | - def test_from_legacy_strings(self): |
593 | | - import _testcapi |
594 | | - Decimal = self.decimal.Decimal |
595 | | - context = self.decimal.Context() |
596 | | - |
597 | | - s = _testcapi.unicode_legacy_string('9.999999') |
598 | | - self.assertEqual(str(Decimal(s)), '9.999999') |
599 | | - self.assertEqual(str(context.create_decimal(s)), '9.999999') |
600 | | - |
601 | 589 | def test_explicit_from_tuples(self): |
602 | 590 | Decimal = self.decimal.Decimal |
603 | 591 |
|
@@ -2928,23 +2916,6 @@ def test_none_args(self): |
2928 | 2916 | assert_signals(self, c, 'traps', [InvalidOperation, DivisionByZero, |
2929 | 2917 | Overflow]) |
2930 | 2918 |
|
2931 | | - @cpython_only |
2932 | | - @requires_legacy_unicode_capi() |
2933 | | - @warnings_helper.ignore_warnings(category=DeprecationWarning) |
2934 | | - def test_from_legacy_strings(self): |
2935 | | - import _testcapi |
2936 | | - c = self.decimal.Context() |
2937 | | - |
2938 | | - for rnd in RoundingModes: |
2939 | | - c.rounding = _testcapi.unicode_legacy_string(rnd) |
2940 | | - self.assertEqual(c.rounding, rnd) |
2941 | | - |
2942 | | - s = _testcapi.unicode_legacy_string('') |
2943 | | - self.assertRaises(TypeError, setattr, c, 'rounding', s) |
2944 | | - |
2945 | | - s = _testcapi.unicode_legacy_string('ROUND_\x00UP') |
2946 | | - self.assertRaises(TypeError, setattr, c, 'rounding', s) |
2947 | | - |
2948 | 2919 | def test_pickle(self): |
2949 | 2920 |
|
2950 | 2921 | for proto in range(pickle.HIGHEST_PROTOCOL + 1): |
@@ -5654,48 +5625,6 @@ def __abs__(self): |
5654 | 5625 | self.assertEqual(Decimal.from_float(cls(101.1)), |
5655 | 5626 | Decimal.from_float(101.1)) |
5656 | 5627 |
|
5657 | | - # Issue 41540: |
5658 | | - @unittest.skipIf(sys.platform.startswith("aix"), |
5659 | | - "AIX: default ulimit: test is flaky because of extreme over-allocation") |
5660 | | - @unittest.skipIf(is_emscripten, "Test is unstable on Emscripten") |
5661 | | - @unittest.skipIf(check_sanitizer(address=True, memory=True), |
5662 | | - "ASAN/MSAN sanitizer defaults to crashing " |
5663 | | - "instead of returning NULL for malloc failure.") |
5664 | | - def test_maxcontext_exact_arith(self): |
5665 | | - |
5666 | | - # Make sure that exact operations do not raise MemoryError due |
5667 | | - # to huge intermediate values when the context precision is very |
5668 | | - # large. |
5669 | | - |
5670 | | - # The following functions fill the available precision and are |
5671 | | - # therefore not suitable for large precisions (by design of the |
5672 | | - # specification). |
5673 | | - MaxContextSkip = ['logical_invert', 'next_minus', 'next_plus', |
5674 | | - 'logical_and', 'logical_or', 'logical_xor', |
5675 | | - 'next_toward', 'rotate', 'shift'] |
5676 | | - |
5677 | | - Decimal = C.Decimal |
5678 | | - Context = C.Context |
5679 | | - localcontext = C.localcontext |
5680 | | - |
5681 | | - # Here only some functions that are likely candidates for triggering a |
5682 | | - # MemoryError are tested. deccheck.py has an exhaustive test. |
5683 | | - maxcontext = Context(prec=C.MAX_PREC, Emin=C.MIN_EMIN, Emax=C.MAX_EMAX) |
5684 | | - with localcontext(maxcontext): |
5685 | | - self.assertEqual(Decimal(0).exp(), 1) |
5686 | | - self.assertEqual(Decimal(1).ln(), 0) |
5687 | | - self.assertEqual(Decimal(1).log10(), 0) |
5688 | | - self.assertEqual(Decimal(10**2).log10(), 2) |
5689 | | - self.assertEqual(Decimal(10**223).log10(), 223) |
5690 | | - self.assertEqual(Decimal(10**19).logb(), 19) |
5691 | | - self.assertEqual(Decimal(4).sqrt(), 2) |
5692 | | - self.assertEqual(Decimal("40E9").sqrt(), Decimal('2.0E+5')) |
5693 | | - self.assertEqual(divmod(Decimal(10), 3), (3, 1)) |
5694 | | - self.assertEqual(Decimal(10) // 3, 3) |
5695 | | - self.assertEqual(Decimal(4) / 2, 2) |
5696 | | - self.assertEqual(Decimal(400) ** -1, Decimal('0.0025')) |
5697 | | - |
5698 | | - |
5699 | 5628 | def test_c_signaldict_segfault(self): |
5700 | 5629 | # See gh-106263 for details. |
5701 | 5630 | SignalDict = type(C.Context().flags) |
|
0 commit comments