Changeset 237
- Timestamp:
- 07/04/06 16:08:25 (3 years ago)
- Files:
-
- branches/composite/formal/examples/composite.py (modified) (1 diff)
- branches/composite/formal/test/test_types.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/composite/formal/examples/composite.py
r236 r237 27 27 28 28 def validate(self, value): 29 30 # Check we have the correct number of values, otherwise the final value 31 # could be completely wrong because we're relying on zip to build the 32 # dict. 33 if len(value) != len(self.composition): 34 raise ValueError("Incorrect number of values to validate") 29 35 30 36 # If nothing has been entered then we'll have a sequence of None branches/composite/formal/test/test_types.py
r236 r237 252 252 ('bar', formal.Integer(required=True)) 253 253 ], required=True).validate, [u'foo', None]) 254 255 def test_wrongNumberOfValues(self): 256 self.assertRaises(ValueError, Composite([ 257 ('foo', formal.Integer()), 258 ('bar', formal.String()), 259 ]).validate, [123]) 260
