mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Register decimals as numbers.Number
This commit is contained in:
parent
4a1b62a555
commit
2c8585b0af
2 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,7 @@ import os, sys
|
|||
import pickle, copy
|
||||
import unittest
|
||||
from decimal import *
|
||||
import numbers
|
||||
from test.test_support import (TestSkipped, run_unittest, run_doctest,
|
||||
is_resource_enabled)
|
||||
import random
|
||||
|
@ -1334,6 +1335,12 @@ class DecimalUsabilityTest(unittest.TestCase):
|
|||
|
||||
class DecimalPythonAPItests(unittest.TestCase):
|
||||
|
||||
def test_abc(self):
|
||||
self.assert_(issubclass(Decimal, numbers.Number))
|
||||
self.assert_(not issubclass(Decimal, numbers.Real))
|
||||
self.assert_(isinstance(Decimal(0), numbers.Number))
|
||||
self.assert_(not isinstance(Decimal(0), numbers.Real))
|
||||
|
||||
def test_pickle(self):
|
||||
d = Decimal('-3.141590000')
|
||||
p = pickle.dumps(d)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue