Changeset 8216 for main/waeup.kofa/trunk/src/waeup/kofa/utils
- Timestamp:
- 19 Apr 2012, 13:05:07 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_converters.py
r8213 r8216 35 35 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 36 36 from waeup.kofa.interfaces import ( 37 SimpleKofaVocabulary, SubjectSource, GradeSource, IFieldConverter) 37 SimpleKofaVocabulary, SubjectSource, GradeSource, IFieldConverter, 38 DELETION_MARKER, IGNORE_MARKER) 38 39 from waeup.kofa.schoolgrades import ResultEntryField 39 40 from waeup.kofa.university import Faculty … … 403 404 self.assertEqual(result_grades[0].grade, g_val1) 404 405 return 406 407 def test_ignore_values(self): 408 # in update mode we ignore marked values 409 converter = IObjectConverter(IContact) 410 err, inv_err, data = converter.fromStringDict( 411 {"friends": IGNORE_MARKER}, 412 Contact(), 413 mode='update') 414 # the ignored key/value are not part of the result 415 self.assertEqual(data, {}) 416 return 417 418 def test_delete_values(self): 419 # in update mode we delete values marked accordingly 420 # 'deleting' means setting to missing_value or to default if required. 421 converter = IObjectConverter(IContact) 422 err, inv_err, data = converter.fromStringDict( 423 {"grades": DELETION_MARKER, 424 "friends": DELETION_MARKER}, 425 'contact', mode='update') 426 # grades are about to be set to default, friends to None 427 self.assertEqual(data, {'grades': [], 'friends': None}) 428 return
Note: See TracChangeset for help on using the changeset viewer.