def test_AVMString(self): avm = AVMMeta() for key, value in list(SPECS_1_1.items()): if type(value) is AVMString: avm.__setitem__(key, self.string_data) self.assertEqual(avm.__getitem__(key), self.string_data, key) avm.__delitem__(key) self.assertEqual(avm.__getitem__(key), None, key) self.assertRaises(TypeError, avm.__setitem__, key, self.unicode_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.date_data) del avm
def test_AVMOrderedFloatList(self): """ .todo:: need to improve """ avm = AVMMeta() for key, value in list(SPECS_1_1.items()): if type(value) is AVMOrderedFloatList: #avm.__setitem__(key, self.float_list_data) #self.assertEqual(avm.__getitem__(key), self.float_list_data, key) #avm.__delitem__(key) #self.assertEqual(avm.__getitem__(key), None, key) #self.assertRaises( AVMListLengthError, avm.__setitem__, key, self.float_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_data) self.assertRaises(TypeError, avm.__setitem__, key, self.unicode_data) self.assertRaises(TypeError, avm.__setitem__, key, self.url_data) self.assertRaises(TypeError, avm.__setitem__, key, self.email_data) #self.assertRaises( TypeError, avm.__setitem__, key, self.string_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.date_data) del avm
def test_AVMOrderedFloatList(self): """ .todo:: need to improve """ avm = AVMMeta() for key, value in SPECS_1_1.items(): if type(value) is AVMOrderedFloatList: # avm.__setitem__(key, self.float_list_data) # self.assertEqual(avm.__getitem__(key), self.float_list_data, key) # avm.__delitem__(key) # self.assertEqual(avm.__getitem__(key), None, key) # self.assertRaises( AVMListLengthError, avm.__setitem__, key, self.float_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_data) self.assertRaises(TypeError, avm.__setitem__, key, self.unicode_data) self.assertRaises(TypeError, avm.__setitem__, key, self.url_data) self.assertRaises(TypeError, avm.__setitem__, key, self.email_data) # self.assertRaises( TypeError, avm.__setitem__, key, self.string_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.date_data) del avm
def test_AVMString(self): avm = AVMMeta() for key, value in SPECS_1_1.items(): if type(value) is AVMString: avm.__setitem__(key, self.string_data) self.assertEqual(avm.__getitem__(key), self.string_data, key) avm.__delitem__(key) self.assertEqual(avm.__getitem__(key), None, key) self.assertRaises(TypeError, avm.__setitem__, key, self.unicode_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_list_data) self.assertRaises(TypeError, avm.__setitem__, key, self.string_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.float_set_data) self.assertRaises(TypeError, avm.__setitem__, key, self.date_data) del avm