ss = None
return cls(data_type,
+ description=schema_dict.get(DESCRIPTION),
default=schema_dict.get(DEFAULT),
schema=ss,
required=schema_dict.get(REQUIRED, False),
s = properties.Schema(properties.STRING)
self.assertTrue(properties.Schema.from_legacy(s) is s)
+ def test_from_legacy_minimal_string(self):
+ s = properties.Schema.from_legacy({
+ 'Type': 'String',
+ })
+ self.assertEqual(properties.STRING, s.type)
+ self.assertEqual(None, s.description)
+ self.assertEqual(None, s.default)
+ self.assertFalse(s.required)
+ self.assertEqual(0, len(s.constraints))
+ self.assertTrue(s.implemented)
+
def test_from_legacy_string(self):
s = properties.Schema.from_legacy({
'Type': 'String',
+ 'Description': 'a string',
'Default': 'wibble',
'Required': True,
'Implemented': False,
'AllowedPattern': '[a-z]*',
})
self.assertEqual(properties.STRING, s.type)
- self.assertEqual(None, s.description)
+ self.assertEqual('a string', s.description)
self.assertEqual('wibble', s.default)
self.assertTrue(s.required)
self.assertEqual(3, len(s.constraints))