Changeset 6268
- Timestamp:
- 2 Jun 2011, 12:23:28 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_converters.py
r6267 r6268 50 50 ('Blue', u'blue'), 51 51 ) 52 52 car_nums = SimpleWAeUPVocabulary( 53 ('None', 0), 54 ('One', 1), 55 ('Two', 2), 56 ('Three', 3), 57 ) 53 58 class IContact(Interface): 54 59 """Sample interface for sample content type used here in tests. … … 80 85 default = u'red', 81 86 vocabulary = colors, 87 ) 88 num_cars = schema.Choice( 89 title = u'Number of cars owned', 90 default = None, 91 vocabulary = car_nums, 82 92 ) 83 93 @invariant … … 285 295 self.assertEqual(err, [('fav_color', u'Invalid value')]) 286 296 assert contact.fav_color == u'red' 297 return 298 299 def test_non_string_choice(self): 300 # We can handle vocabs with non-string values 301 converter = IObjectConverter(IContact) # a converter to IContact 302 err, inv_err, contact = converter.applyRowData( 303 dict(num_cars='1'), 'contact') 304 assert contact.num_cars == 1 287 305 return 288 306
Note: See TracChangeset for help on using the changeset viewer.