[Zope3-checkins] CVS: Zope3/src/zope/i18n/tests - test_formats.py:1.9

Stephan Richter srichter@cosmos.phy.tufts.edu
Sat, 26 Jul 2003 09:11:21 -0400


Update of /cvs-repository/Zope3/src/zope/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv9459/src/zope/i18n/tests

Modified Files:
	test_formats.py 
Log Message:
Fixed two bugs in the I18n formatter.

Urgent To Do's:

- Support of Timezones in zope.i18n.format

- Removal of the datetimeutils code; it is not I18n aware...


=== Zope3/src/zope/i18n/tests/test_formats.py 1.8 => 1.9 ===
--- Zope3/src/zope/i18n/tests/test_formats.py:1.8	Sat Apr 12 20:21:42 2003
+++ Zope3/src/zope/i18n/tests/test_formats.py	Sat Jul 26 09:11:17 2003
@@ -207,6 +207,11 @@
         self.assertRaises(DateTimeParseError,
             self.format.parse, '02.01.03 21:48', 'dd.MM.yyyy HH:mm')
 
+    def testParse12PM(self):
+        self.assertEqual(
+            self.format.parse('01.01.03 12:00 nachm.', 'dd.MM.yy hh:mm a'),
+            datetime.datetime(2003, 01, 01, 12, 00, 00, 00))
+
     def testFormatSimpleDateTime(self):
         # German short
         self.assertEqual(
@@ -248,8 +253,16 @@
                 "EEEE, d. MMMM yyyy H:mm' Uhr 'z"),
                 '%s, %i. Januar 2003 21:48 Uhr +000' %(
                 self.format.calendar.weekdays[day][0], day+4))
-        
 
+    def testFormatSimpleHourRepresentation(self):
+        self.assertEqual(
+            self.format.format(datetime.datetime(2003, 01, 02, 23, 00),
+                               'dd.MM.yy h:mm:ss a'),
+            '02.01.03 11:00:00 nachm.')
+        self.assertEqual(
+            self.format.format(datetime.datetime(2003, 01, 02, 02, 00),
+                               'dd.MM.yy h:mm:ss a'),
+            '02.01.03 2:00:00 vorm.')
 
 class TestNumberPatternParser(TestCase):
     """Extensive tests for the ICU-based-syntax number pattern parser."""