[Python-checkins] r56759 - python/branches/decimal-branch/Lib/decimal.py
facundo.batista
python-checkins at python.org
Mon Aug 6 01:00:51 CEST 2007
Author: facundo.batista
Date: Mon Aug 6 01:00:50 2007
New Revision: 56759
Modified:
python/branches/decimal-branch/Lib/decimal.py
Log:
Fixed number_class() doc tests
Modified: python/branches/decimal-branch/Lib/decimal.py
==============================================================================
--- python/branches/decimal-branch/Lib/decimal.py (original)
+++ python/branches/decimal-branch/Lib/decimal.py Mon Aug 6 01:00:50 2007
@@ -3751,32 +3751,35 @@
+Normal
+Infinity
- >>> ExtendedContext.number_class(Decimal('Infinity'))
- "+Infinity"
- >>> ExtendedContext.number_class(Decimal('1E-10'))
- "+Normal"
- >>> ExtendedContext.number_class(Decimal('2.50'))
- "+Normal"
- >>> ExtendedContext.number_class(Decimal('0.1E-999'))
- "+Subnormal"
- >>> ExtendedContext.number_class(Decimal('0'))
- "+Zero"
- >>> ExtendedContext.number_class(Decimal('-0'))
- "-Zero"
- >>> ExtendedContext.number_class(Decimal('-0.1E-999'))
- "-Subnormal"
- >>> ExtendedContext.number_class(Decimal('-1E-10'))
- "-Normal"
- >>> ExtendedContext.number_class(Decimal('-2.50'))
- "-Normal"
- >>> ExtendedContext.number_class(Decimal('-Infinity'))
- "-Infinity"
- >>> ExtendedContext.number_class(Decimal('NaN'))
- "NaN"
- >>> ExtendedContext.number_class(Decimal('-NaN'))
- "NaN"
- >>> ExtendedContext.number_class(Decimal('sNaN'))
- "sNaN"
+ >>> c = Context(ExtendedContext)
+ >>> c.Emin = -999
+ >>> c.Emax = 999
+ >>> c.number_class(Decimal('Infinity'))
+ '+Infinity'
+ >>> c.number_class(Decimal('1E-10'))
+ '+Normal'
+ >>> c.number_class(Decimal('2.50'))
+ '+Normal'
+ >>> c.number_class(Decimal('0.1E-999'))
+ '+Subnormal'
+ >>> c.number_class(Decimal('0'))
+ '+Zero'
+ >>> c.number_class(Decimal('-0'))
+ '-Zero'
+ >>> c.number_class(Decimal('-0.1E-999'))
+ '-Subnormal'
+ >>> c.number_class(Decimal('-1E-10'))
+ '-Normal'
+ >>> c.number_class(Decimal('-2.50'))
+ '-Normal'
+ >>> c.number_class(Decimal('-Infinity'))
+ '-Infinity'
+ >>> c.number_class(Decimal('NaN'))
+ 'NaN'
+ >>> c.number_class(Decimal('-NaN'))
+ 'NaN'
+ >>> c.number_class(Decimal('sNaN'))
+ 'sNaN'
"""
return a.number_class(context=self)
More information about the Python-checkins
mailing list