Changeset 8158 for main/waeup.kofa/trunk/src/waeup/kofa/schema/tests
- Timestamp:
- 15 Apr 2012, 00:30:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/schema/tests/test_fields.py
r8151 r8158 3 3 import unittest 4 4 from zope.interface.verify import verifyClass, verifyObject 5 from zope.schema.interfaces import IDate 6 from waeup.kofa.schema import FormattedDate 7 from waeup.kofa.schema.interfaces import IFormattedDate 5 from zope.schema.interfaces import IDate, IDatetime 6 from waeup.kofa.schema import FormattedDate, FormattedDatetime 7 from waeup.kofa.schema.interfaces import IFormattedDate, IFormattedDatetime 8 8 9 9 class FormattedDateTests(unittest.TestCase): … … 32 32 self.assertEqual(obj.date_format, '%d.%m.%Y') 33 33 return 34 35 class FormattedDatetimeTests(unittest.TestCase): 36 # Tests for FormattedDatetime field. 37 38 def test_iface(self): 39 # make sure we fullfill interface contracts 40 obj = FormattedDatetime() 41 verifyClass(IDatetime, FormattedDatetime) 42 verifyClass(IFormattedDatetime, FormattedDatetime) 43 verifyObject(IDatetime, obj) 44 verifyObject(IFormattedDatetime, obj) 45 return 46 47 def test_defaults(self): 48 # we get expected default values for datetimes. 49 obj = FormattedDatetime() 50 self.assertEqual(obj.show_time, True) 51 self.assertEqual(obj.date_format, None) 52 return 53 54 def test_attribs(self): 55 # we can set the promised attributes. 56 obj = FormattedDatetime(show_time=False, 57 date_format='%d.%m.%Y %H:%M:%S Uhr') 58 self.assertEqual(obj.show_time, False) 59 self.assertEqual(obj.date_format, '%d.%m.%Y %H:%M:%S Uhr') 60 return
Note: See TracChangeset for help on using the changeset viewer.