comparison babel/tests/numbers.py @ 588:acdb8f9c9ce6 trunk

disable doctests for babel.numbers in Python 2.4 due to changed Decimal repr output
author fschwarz
date Wed, 08 Aug 2012 12:23:20 +0000
parents 964cd2ec6f94
children
comparison
equal deleted inserted replaced
587:964cd2ec6f94 588:acdb8f9c9ce6
12 # history and logs, available at http://babel.edgewall.org/log/. 12 # history and logs, available at http://babel.edgewall.org/log/.
13 13
14 from decimal import Decimal 14 from decimal import Decimal
15 import doctest 15 import doctest
16 import unittest 16 import unittest
17 import sys
17 18
18 from babel import numbers 19 from babel import numbers
19 20
20 21
21 class FormatDecimalTestCase(unittest.TestCase): 22 class FormatDecimalTestCase(unittest.TestCase):
172 lambda: numbers.parse_decimal('2,109,998', locale='de')) 173 lambda: numbers.parse_decimal('2,109,998', locale='de'))
173 174
174 175
175 def suite(): 176 def suite():
176 suite = unittest.TestSuite() 177 suite = unittest.TestSuite()
177 suite.addTest(doctest.DocTestSuite(numbers)) 178 if sys.version_info >= (2, 5):
179 # repr(Decimal(...)) was changed 2.5
180 # Python 2.4: Decimal("1")
181 # Python 2.5+: Decimal('1')
182 # as the actual functionality is tested by unit tests, I don't see a
183 # point in adding ugly workarounds in the doctests so just disable
184 # these doctests for 2.4
185 suite.addTest(doctest.DocTestSuite(numbers))
178 suite.addTest(unittest.makeSuite(FormatDecimalTestCase)) 186 suite.addTest(unittest.makeSuite(FormatDecimalTestCase))
179 suite.addTest(unittest.makeSuite(BankersRoundTestCase)) 187 suite.addTest(unittest.makeSuite(BankersRoundTestCase))
180 suite.addTest(unittest.makeSuite(NumberParsingTestCase)) 188 suite.addTest(unittest.makeSuite(NumberParsingTestCase))
181 return suite 189 return suite
182 190
Copyright (C) 2012-2017 Edgewall Software