[Zope3-checkins] CVS: Zope3/src/zope/i18n/tests - test_formats.py:1.6 test_locales.py:1.4
Albertas Agejevas
alga@codeworks.lt
Thu, 13 Mar 2003 13:49:45 -0500
Update of /cvs-repository/Zope3/src/zope/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv1411/src/zope/i18n/tests
Modified Files:
test_formats.py test_locales.py
Log Message:
An unexpected raid by the Whitespace Police.
Other than fixes of nonconforming whitespace, just a couple of $Id$
docstrings has been added.
=== Zope3/src/zope/i18n/tests/test_formats.py 1.5 => 1.6 ===
--- Zope3/src/zope/i18n/tests/test_formats.py:1.5 Mon Jan 27 16:51:56 2003
+++ Zope3/src/zope/i18n/tests/test_formats.py Thu Mar 13 13:49:14 2003
@@ -66,7 +66,7 @@
# German short
self.assertEqual(parseDateTimePattern("HH:mm"),
[('H', 2), ':', ('m', 2)])
-
+
def testParseRealDate(self):
# German full
self.assertEqual(parseDateTimePattern("EEEE, d. MMMM yyyy"),
@@ -163,7 +163,7 @@
class TestDateTimeFormat(TestCase):
"""Test the functionality of an implmentation of the ILocaleProvider
- interface."""
+ interface."""
path = os.path.join(testdir, 'xmllocales', 'de.xml')
locale = ICUXMLLocaleFactory(path)()
@@ -175,72 +175,72 @@
def testParseSimpleDateTime(self):
# German short
self.assertEqual(
- self.format.parse('02.01.03 21:48', 'dd.MM.yy HH:mm'),
+ self.format.parse('02.01.03 21:48', 'dd.MM.yy HH:mm'),
datetime.datetime(2003, 01, 02, 21, 48))
def testParseRealDateTime(self):
# German medium
self.assertEqual(
- self.format.parse('02.01.2003 21:48:01', 'dd.MM.yyyy HH:mm:ss'),
+ self.format.parse('02.01.2003 21:48:01', 'dd.MM.yyyy HH:mm:ss'),
datetime.datetime(2003, 01, 02, 21, 48, 01))
# German long
# XXX The parser does not support timezones yet.
self.assertEqual(self.format.parse(
'2. Januar 2003 21:48:01 +100',
- 'd. MMMM yyyy HH:mm:ss z'),
+ 'd. MMMM yyyy HH:mm:ss z'),
datetime.datetime(2003, 01, 02, 21, 48, 01))
# German full
# XXX The parser does not support timezones yet.
self.assertEqual(self.format.parse(
'Donnerstag, 2. Januar 2003 21:48 Uhr +100',
- "EEEE, d. MMMM yyyy H:mm' Uhr 'z"),
+ "EEEE, d. MMMM yyyy H:mm' Uhr 'z"),
datetime.datetime(2003, 01, 02, 21, 48))
def testParseAMPMDateTime(self):
self.assertEqual(
- self.format.parse('02.01.03 09:48 nachm.', 'dd.MM.yy hh:mm a'),
+ self.format.parse('02.01.03 09:48 nachm.', 'dd.MM.yy hh:mm a'),
datetime.datetime(2003, 01, 02, 21, 48))
def testDateTimeParseError(self):
- self.assertRaises(DateTimeParseError,
+ self.assertRaises(DateTimeParseError,
self.format.parse, '02.01.03 21:48', 'dd.MM.yyyy HH:mm')
-
+
def testFormatSimpleDateTime(self):
# German short
self.assertEqual(
self.format.format(datetime.datetime(2003, 01, 02, 21, 48),
- 'dd.MM.yy HH:mm'),
+ 'dd.MM.yy HH:mm'),
'02.01.03 21:48')
def testFormatRealDateTime(self):
# German medium
self.assertEqual(
self.format.format(datetime.datetime(2003, 01, 02, 21, 48, 01),
- 'dd.MM.yyyy HH:mm:ss'),
+ 'dd.MM.yyyy HH:mm:ss'),
'02.01.2003 21:48:01')
# German long
# XXX The parser does not support timezones yet.
self.assertEqual(self.format.format(
datetime.datetime(2003, 01, 02, 21, 48, 01),
- 'd. MMMM yyyy HH:mm:ss z'),
+ 'd. MMMM yyyy HH:mm:ss z'),
'2. Januar 2003 21:48:01 +000')
# German full
# XXX The parser does not support timezones yet.
self.assertEqual(self.format.format(
datetime.datetime(2003, 01, 02, 21, 48),
- "EEEE, d. MMMM yyyy H:mm' Uhr 'z"),
+ "EEEE, d. MMMM yyyy H:mm' Uhr 'z"),
'Donnerstag, 2. Januar 2003 21:48 Uhr +000')
def testFormatAMPMDateTime(self):
self.assertEqual(self.format.format(
datetime.datetime(2003, 01, 02, 21, 48),
- 'dd.MM.yy hh:mm a'),
+ 'dd.MM.yy hh:mm a'),
'02.01.03 09:48 nachm.')
-
+
class TestNumberPatternParser(TestCase):
"""Extensive tests for the ICU-based-syntax number pattern parser."""
@@ -248,216 +248,216 @@
def testParseSimpleIntegerPattern(self):
self.assertEqual(
parseNumberPattern('###0'),
- ( (None, '', None, '###0', '', '', None, '', None, 0),
- (None, '', None, '###0', '', '', None, '', None, 0)) )
+ ((None, '', None, '###0', '', '', None, '', None, 0),
+ (None, '', None, '###0', '', '', None, '', None, 0)))
def testParseScientificIntegerPattern(self):
self.assertEqual(
parseNumberPattern('###0E#0'),
- ( (None, '', None, '###0', '', '#0', None, '', None, 0),
- (None, '', None, '###0', '', '#0', None, '', None, 0)) )
+ ((None, '', None, '###0', '', '#0', None, '', None, 0),
+ (None, '', None, '###0', '', '#0', None, '', None, 0)))
def testParsePosNegAlternativeIntegerPattern(self):
self.assertEqual(
parseNumberPattern('###0;#0'),
- ( (None, '', None, '###0', '', '', None, '', None, 0),
- (None, '', None, '#0', '', '', None, '', None, 0)) )
+ ((None, '', None, '###0', '', '', None, '', None, 0),
+ (None, '', None, '#0', '', '', None, '', None, 0)))
def testParsePrefixedIntegerPattern(self):
self.assertEqual(
parseNumberPattern('+###0'),
- ( (None, '+', None, '###0', '', '', None, '', None, 0),
- (None, '+', None, '###0', '', '', None, '', None, 0)) )
+ ((None, '+', None, '###0', '', '', None, '', None, 0),
+ (None, '+', None, '###0', '', '', None, '', None, 0)))
def testParsePosNegIntegerPattern(self):
self.assertEqual(
parseNumberPattern('+###0;-###0'),
- ( (None, '+', None, '###0', '', '', None, '', None, 0),
- (None, '-', None, '###0', '', '', None, '', None, 0)) )
+ ((None, '+', None, '###0', '', '', None, '', None, 0),
+ (None, '-', None, '###0', '', '', None, '', None, 0)))
def testParseScientificPosNegIntegerPattern(self):
self.assertEqual(
parseNumberPattern('+###0E0;-###0E#0'),
- ( (None, '+', None, '###0', '', '0', None, '', None, 0),
- (None, '-', None, '###0', '', '#0', None, '', None, 0)) )
+ ((None, '+', None, '###0', '', '0', None, '', None, 0),
+ (None, '-', None, '###0', '', '#0', None, '', None, 0)))
def testParseThousandSeparatorIntegerPattern(self):
self.assertEqual(
parseNumberPattern('#,##0'),
- ( (None, '', None, '###0', '', '', None, '', None, 1),
- (None, '', None, '###0', '', '', None, '', None, 1)) )
-
+ ((None, '', None, '###0', '', '', None, '', None, 1),
+ (None, '', None, '###0', '', '', None, '', None, 1)))
+
def testParseSimpleDecimalPattern(self):
self.assertEqual(
parseNumberPattern('###0.00#'),
- ( (None, '', None, '###0', '00#', '', None, '', None, 0),
- (None, '', None, '###0', '00#', '', None, '', None, 0)) )
+ ((None, '', None, '###0', '00#', '', None, '', None, 0),
+ (None, '', None, '###0', '00#', '', None, '', None, 0)))
def testParseScientificDecimalPattern(self):
self.assertEqual(
parseNumberPattern('###0.00#E#0'),
- ( (None, '', None, '###0', '00#', '#0', None, '', None, 0),
- (None, '', None, '###0', '00#', '#0', None, '', None, 0)) )
+ ((None, '', None, '###0', '00#', '#0', None, '', None, 0),
+ (None, '', None, '###0', '00#', '#0', None, '', None, 0)))
def testParsePosNegAlternativeFractionPattern(self):
self.assertEqual(
parseNumberPattern('###0.00#;#0.0#'),
- ( (None, '', None, '###0', '00#', '', None, '', None, 0),
- (None, '', None, '#0', '0#', '', None, '', None, 0)) )
+ ((None, '', None, '###0', '00#', '', None, '', None, 0),
+ (None, '', None, '#0', '0#', '', None, '', None, 0)))
def testParsePosNegFractionPattern(self):
self.assertEqual(
parseNumberPattern('+###0.0##;-###0.0##'),
- ( (None, '+', None, '###0', '0##', '', None, '', None, 0),
- (None, '-', None, '###0', '0##', '', None, '', None, 0)) )
+ ((None, '+', None, '###0', '0##', '', None, '', None, 0),
+ (None, '-', None, '###0', '0##', '', None, '', None, 0)))
def testParseScientificPosNegFractionPattern(self):
self.assertEqual(
parseNumberPattern('+###0.0##E#0;-###0.0##E0'),
- ( (None, '+', None, '###0', '0##', '#0', None, '', None, 0),
- (None, '-', None, '###0', '0##', '0', None, '', None, 0)) )
+ ((None, '+', None, '###0', '0##', '#0', None, '', None, 0),
+ (None, '-', None, '###0', '0##', '0', None, '', None, 0)))
def testParseThousandSeparatorFractionPattern(self):
self.assertEqual(
parseNumberPattern('#,##0.0#'),
- ( (None, '', None, '###0', '0#', '', None, '', None, 1),
- (None, '', None, '###0', '0#', '', None, '', None, 1)) )
+ ((None, '', None, '###0', '0#', '', None, '', None, 1),
+ (None, '', None, '###0', '0#', '', None, '', None, 1)))
def testParsePadding1WithoutPrefixPattern(self):
self.assertEqual(
parseNumberPattern('* ###0'),
- ( (' ', '', None, '###0', '', '', None, '', None, 0),
- (' ', '', None, '###0', '', '', None, '', None, 0)) )
+ ((' ', '', None, '###0', '', '', None, '', None, 0),
+ (' ', '', None, '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* ###0.0##'),
- ( (' ', '', None, '###0', '0##', '', None, '', None, 0),
- (' ', '', None, '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '', None, '###0', '0##', '', None, '', None, 0),
+ (' ', '', None, '###0', '0##', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* ###0.0##;*_###0.0##'),
- ( (' ', '', None, '###0', '0##', '', None, '', None, 0),
- ('_', '', None, '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '', None, '###0', '0##', '', None, '', None, 0),
+ ('_', '', None, '###0', '0##', '', None, '', None, 0)))
def testParsePadding1WithPrefixPattern(self):
self.assertEqual(
parseNumberPattern('* +###0'),
- ( (' ', '+', None, '###0', '', '', None, '', None, 0),
- (' ', '+', None, '###0', '', '', None, '', None, 0)) )
+ ((' ', '+', None, '###0', '', '', None, '', None, 0),
+ (' ', '+', None, '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* +###0.0##'),
- ( (' ', '+', None, '###0', '0##', '', None, '', None, 0),
- (' ', '+', None, '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '+', None, '###0', '0##', '', None, '', None, 0),
+ (' ', '+', None, '###0', '0##', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* +###0.0##;*_-###0.0##'),
- ( (' ', '+', None, '###0', '0##', '', None, '', None, 0),
- ('_', '-', None, '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '+', None, '###0', '0##', '', None, '', None, 0),
+ ('_', '-', None, '###0', '0##', '', None, '', None, 0)))
def testParsePadding1Padding2WithPrefixPattern(self):
self.assertEqual(
parseNumberPattern('* +* ###0'),
- ( (' ', '+', ' ', '###0', '', '', None, '', None, 0),
- (' ', '+', ' ', '###0', '', '', None, '', None, 0)) )
+ ((' ', '+', ' ', '###0', '', '', None, '', None, 0),
+ (' ', '+', ' ', '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* +* ###0.0##'),
- ( (' ', '+', ' ', '###0', '0##', '', None, '', None, 0),
- (' ', '+', ' ', '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '+', ' ', '###0', '0##', '', None, '', None, 0),
+ (' ', '+', ' ', '###0', '0##', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('* +* ###0.0##;*_-*_###0.0##'),
- ( (' ', '+', ' ', '###0', '0##', '', None, '', None, 0),
- ('_', '-', '_', '###0', '0##', '', None, '', None, 0)) )
+ ((' ', '+', ' ', '###0', '0##', '', None, '', None, 0),
+ ('_', '-', '_', '###0', '0##', '', None, '', None, 0)))
def testParsePadding3WithoutSufffixPattern(self):
self.assertEqual(
parseNumberPattern('###0* '),
- ( (None, '', None, '###0', '', '', ' ', '', None, 0),
- (None, '', None, '###0', '', '', ' ', '', None, 0)) )
+ ((None, '', None, '###0', '', '', ' ', '', None, 0),
+ (None, '', None, '###0', '', '', ' ', '', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0##* '),
- ( (None, '', None, '###0', '0##', '', ' ', '', None, 0),
- (None, '', None, '###0', '0##', '', ' ', '', None, 0)) )
+ ((None, '', None, '###0', '0##', '', ' ', '', None, 0),
+ (None, '', None, '###0', '0##', '', ' ', '', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0##* ;###0.0##*_'),
- ( (None, '', None, '###0', '0##', '', ' ', '', None, 0),
- (None, '', None, '###0', '0##', '', '_', '', None, 0)) )
+ ((None, '', None, '###0', '0##', '', ' ', '', None, 0),
+ (None, '', None, '###0', '0##', '', '_', '', None, 0)))
def testParsePadding3InScientificPattern(self):
self.assertEqual(
parseNumberPattern('###0E#0* '),
- ( (None, '', None, '###0', '', '#0', ' ', '', None, 0),
- (None, '', None, '###0', '', '#0', ' ', '', None, 0)) )
+ ((None, '', None, '###0', '', '#0', ' ', '', None, 0),
+ (None, '', None, '###0', '', '#0', ' ', '', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0##E0* '),
- ( (None, '', None, '###0', '0##', '0', ' ', '', None, 0),
- (None, '', None, '###0', '0##', '0', ' ', '', None, 0)) )
+ ((None, '', None, '###0', '0##', '0', ' ', '', None, 0),
+ (None, '', None, '###0', '0##', '0', ' ', '', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0##E#0* ;###0.0##E0*_'),
- ( (None, '', None, '###0', '0##', '#0', ' ', '', None, 0),
- (None, '', None, '###0', '0##', '0', '_', '', None, 0)) )
+ ((None, '', None, '###0', '0##', '#0', ' ', '', None, 0),
+ (None, '', None, '###0', '0##', '0', '_', '', None, 0)))
def testParsePadding3WithSufffixPattern(self):
self.assertEqual(
parseNumberPattern('###0* /'),
- ( (None, '', None, '###0', '', '', ' ', '/', None, 0),
- (None, '', None, '###0', '', '', ' ', '/', None, 0)) )
+ ((None, '', None, '###0', '', '', ' ', '/', None, 0),
+ (None, '', None, '###0', '', '', ' ', '/', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0#* /'),
- ( (None, '', None, '###0', '0#', '', ' ', '/', None, 0),
- (None, '', None, '###0', '0#', '', ' ', '/', None, 0)) )
+ ((None, '', None, '###0', '0#', '', ' ', '/', None, 0),
+ (None, '', None, '###0', '0#', '', ' ', '/', None, 0)))
self.assertEqual(
parseNumberPattern('###0.0#* /;###0.0#*_/'),
- ( (None, '', None, '###0', '0#', '', ' ', '/', None, 0),
- (None, '', None, '###0', '0#', '', '_', '/', None, 0)) )
+ ((None, '', None, '###0', '0#', '', ' ', '/', None, 0),
+ (None, '', None, '###0', '0#', '', '_', '/', None, 0)))
def testParsePadding3And4WithSuffixPattern(self):
self.assertEqual(
parseNumberPattern('###0* /* '),
- ( (None, '', None, '###0', '', '', ' ', '/', ' ', 0),
- (None, '', None, '###0', '', '', ' ', '/', ' ', 0)) )
+ ((None, '', None, '###0', '', '', ' ', '/', ' ', 0),
+ (None, '', None, '###0', '', '', ' ', '/', ' ', 0)))
self.assertEqual(
parseNumberPattern('###0* /* ;###0*_/*_'),
- ( (None, '', None, '###0', '', '', ' ', '/', ' ', 0),
- (None, '', None, '###0', '', '', '_', '/', '_', 0)) )
+ ((None, '', None, '###0', '', '', ' ', '/', ' ', 0),
+ (None, '', None, '###0', '', '', '_', '/', '_', 0)))
def testParseMultipleCharacterPrefix(self):
self.assertEqual(
parseNumberPattern('DM###0'),
- ( (None, 'DM', None, '###0', '', '', None, '', None, 0),
- (None, 'DM', None, '###0', '', '', None, '', None, 0)) )
+ ((None, 'DM', None, '###0', '', '', None, '', None, 0),
+ (None, 'DM', None, '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern('DM* ###0'),
- ( (None, 'DM', ' ', '###0', '', '', None, '', None, 0),
- (None, 'DM', ' ', '###0', '', '', None, '', None, 0)) )
+ ((None, 'DM', ' ', '###0', '', '', None, '', None, 0),
+ (None, 'DM', ' ', '###0', '', '', None, '', None, 0)))
def testParseStringEscapedPrefix(self):
self.assertEqual(
parseNumberPattern("'DEM'###0"),
- ( (None, 'DEM', None, '###0', '', '', None, '', None, 0),
- (None, 'DEM', None, '###0', '', '', None, '', None, 0)) )
+ ((None, 'DEM', None, '###0', '', '', None, '', None, 0),
+ (None, 'DEM', None, '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern("D'EM'###0"),
- ( (None, 'DEM', None, '###0', '', '', None, '', None, 0),
- (None, 'DEM', None, '###0', '', '', None, '', None, 0)) )
+ ((None, 'DEM', None, '###0', '', '', None, '', None, 0),
+ (None, 'DEM', None, '###0', '', '', None, '', None, 0)))
self.assertEqual(
parseNumberPattern("D'E'M###0"),
- ( (None, 'DEM', None, '###0', '', '', None, '', None, 0),
- (None, 'DEM', None, '###0', '', '', None, '', None, 0)) )
+ ((None, 'DEM', None, '###0', '', '', None, '', None, 0),
+ (None, 'DEM', None, '###0', '', '', None, '', None, 0)))
def testParseStringEscapedSuffix(self):
self.assertEqual(
parseNumberPattern("###0'DEM'"),
- ( (None, '', None, '###0', '', '', None, 'DEM', None, 0),
- (None, '', None, '###0', '', '', None, 'DEM', None, 0)) )
+ ((None, '', None, '###0', '', '', None, 'DEM', None, 0),
+ (None, '', None, '###0', '', '', None, 'DEM', None, 0)))
self.assertEqual(
parseNumberPattern("###0D'EM'"),
- ( (None, '', None, '###0', '', '', None, 'DEM', None, 0),
- (None, '', None, '###0', '', '', None, 'DEM', None, 0)) )
+ ((None, '', None, '###0', '', '', None, 'DEM', None, 0),
+ (None, '', None, '###0', '', '', None, 'DEM', None, 0)))
self.assertEqual(
parseNumberPattern("###0D'E'M"),
- ( (None, '', None, '###0', '', '', None, 'DEM', None, 0),
- (None, '', None, '###0', '', '', None, 'DEM', None, 0)) )
-
+ ((None, '', None, '###0', '', '', None, 'DEM', None, 0),
+ (None, '', None, '###0', '', '', None, 'DEM', None, 0)))
+
class TestNumberFormat(TestCase):
- """Test the functionality of an implmentation of the NumberFormat."""
+ """Test the functionality of an implmentation of the NumberFormat."""
path = os.path.join(testdir, 'xmllocales', 'de_DE.xml')
locale = ICUXMLLocaleFactory(path)()
@@ -578,7 +578,7 @@
41.02)
self.assertEqual(self.format.parse('41.02__', '#0.0###* ;#0.0###*_'),
-41.02)
-
+
def testParsePadding3WithSufffix(self):
self.assertEqual(
self.format.parse('[41.02 ]', '[#0.0###* ];(#0.0###*_)'),
@@ -612,7 +612,7 @@
'23341')
self.assertEqual(self.format.format(41, '#000'),
'041')
-
+
def testFormatScientificInteger(self):
self.assertEqual(self.format.format(23341, '0.000#E0'),
'2.3341E4')
@@ -730,7 +730,7 @@
'41.02 ')
self.assertEqual(self.format.format(-41.02, '#0.0###* ;#0.0###*_'),
'41.02__')
-
+
def testFormatPadding3WithSufffix(self):
self.assertEqual(self.format.format(41.02, '[#0.0###* ];(#0.0###*_)'),
'[41.02 ]')
@@ -761,4 +761,4 @@
makeSuite(TestDateTimeFormat),
makeSuite(TestNumberPatternParser),
makeSuite(TestNumberFormat),
- ))
+ ))
=== Zope3/src/zope/i18n/tests/test_locales.py 1.3 => 1.4 ===
--- Zope3/src/zope/i18n/tests/test_locales.py:1.3 Mon Jan 27 16:51:56 2003
+++ Zope3/src/zope/i18n/tests/test_locales.py Thu Mar 13 13:49:14 2003
@@ -19,7 +19,7 @@
import datetime
from unittest import TestCase, TestSuite, makeSuite
-from zope.i18n.interfaces import ILocaleProvider, ILocale
+from zope.i18n.interfaces import ILocaleProvider, ILocale
from zope.i18n.interfaces import ILocaleVersion, ILocaleIdentity
from zope.i18n.interfaces import ILocaleTimeZone, ILocaleCalendar
from zope.i18n.interfaces import ILocaleNumberFormat, ILocaleCurrency
@@ -28,15 +28,15 @@
from zope.i18n.locales import LocaleProvider, ICULocale, ICUXMLLocaleFactory
from zope.i18n.locales import locales
from zope.i18n.locales import ICULocaleVersion, ICULocaleIdentity
-from zope.i18n.locales import ICULocaleTimeZone, ICULocaleCalendar
-from zope.i18n.locales import ICULocaleNumberFormat, ICULocaleCurrency
+from zope.i18n.locales import ICULocaleTimeZone, ICULocaleCalendar
+from zope.i18n.locales import ICULocaleNumberFormat, ICULocaleCurrency
from zope.i18n import tests
testdir = os.path.dirname(tests.__file__)
class TestILocaleProvider(TestCase):
"""Test the functionality of an implmentation of the ILocaleProvider
- interface."""
+ interface."""
def _makeNewProvider(self):
raise NotImplemented
@@ -193,7 +193,7 @@
self.cal._time_patterns = {'medium': 'HH:mm:ss'}
self.cal._date_patterns = {'medium': 'dd.MM.yyyy'}
self.cal._datetime_pattern = '{1} {0}'
-
+
def testInterfaceConformity(self):
self.assert_(ILocaleCalendar.isImplementedBy(self.cal))
@@ -276,7 +276,7 @@
self.cal.setTimePattern('long', 'HH:mm:ss z')
self.assertEqual(self.cal._time_patterns,
{'medium': 'HH:mm:ss', 'long': 'HH:mm:ss z'})
-
+
def test_getTimePattern(self):
self.assertEqual(self.cal.getTimePattern('medium'), 'HH:mm:ss')
@@ -338,7 +338,7 @@
def test_getSymbolMap(self):
self.assertEqual(self.format.getSymbolMap(), {'decimal': '.'})
-
+
class TestICULocaleCurrency(TestCase):
@@ -358,7 +358,7 @@
def test_getSymbol(self):
self.assertEqual(self.curr.getSymbol(), '$')
-
+
def test_setName(self):
self.curr.setName('EUR')
self.assertEqual(self.curr._name, 'EUR')
@@ -391,7 +391,7 @@
os.path.join(testdir, 'xmllocales', 'de_DE.xml'))
factory3 = ICUXMLLocaleFactory(
os.path.join(testdir, 'xmllocales', 'de_DE_PREEURO.xml'))
-
+
def test_GermanySpecificGermanLocale(self):
# Well, if the factory can create the Locale we are in good
# shape. This test is only suppose to test whether XML-files with
@@ -483,10 +483,10 @@
self.assertEqual(curr[1].getDecimal(), u',')
self.assertEqual(curr[1].getPattern(), None)
self.assertEqual(curr[2], True)
-
+
class TestICULocale(TestCase):
-
+
path = os.path.join(testdir, 'xmllocales', 'root.xml')
localeFactory = ICUXMLLocaleFactory(path)
locale = localeFactory()
@@ -557,7 +557,7 @@
self.assertEqual(cal.getMonth(1), (u'January', u'Jan'))
self.assertEqual(cal.getWeekday(1), (u'Sunday', u'Sun'))
self.assertEqual(cal.getDatePattern('full'), 'EEEE, MMMM d, yyyy')
-
+
def test_getDefaultCalendar(self):
cal = self.locale.getDefaultCalendar()
self.assertEqual(cal.klass, u'gregorian')
@@ -571,7 +571,7 @@
self.assertEqual(format.klass, u'decimal')
self.assertEqual(format.getPattern('decimal'), u'#,##0.###;-#,##0.###')
self.assertEqual(format.getSymbol('exponential'), u'E')
-
+
def test_getDefaultNumberFormat(self):
format = self.locale.getDefaultNumberFormat()
self.assertEqual(format.klass, u'decimal')
@@ -586,7 +586,7 @@
self.assertEqual(curr.getName(), u'XXX')
self.assertEqual(curr.getSymbol(), u'\xa4')
self.assertEqual(curr.getDecimal(), u'.')
-
+
def test_getDefaultCurrency(self):
curr = self.locale.getDefaultCurrency()
self.assertEqual(curr.id, u'XXX')
@@ -600,7 +600,7 @@
# Set the locale on the class so that test cases don't have
# to pay to construct a new one each time.
-
+
orig = locales._locale_dir
locales._locale_dir = os.path.join(testdir, 'xmllocales')
locales.loadLocale(None, None, None)
@@ -609,7 +609,7 @@
locales.loadLocale('de', 'DE', 'PREEURO')
locale = locales.getLocale('de', 'DE', 'PREEURO')
locales._locale_dir = orig
-
+
def test_getDisplayLanguage(self):
self.assertEqual(self.locale.getDisplayLanguage('de'), 'Deutsch')
self.assertRaises(KeyError, self.locale.getDisplayLanguage,
@@ -653,7 +653,7 @@
self.assertEqual(formatter.parse('1,234.567'), 1234.567)
self.assertEqual(formatter.parse('-1,234.567'), -1234.567)
-
+
class TestGlobalLocaleProvider(TestCase):
def testLoading(self):