def test_base_get_dict(self): testRec = DataObject() testRec.test = 'tester' testRec.count = 1 outDict = testRec.getDictValue() self.assertEqual(outDict['test'], 'tester') self.assertEqual(outDict['count'], 1)
def test_root_create(self): model = DataObject() self.assertIsInstance(model, DataObject)
def test_root_createFromDict(self): model = DataObject.createFromDict(**{'test': 'tester'}) self.assertIsInstance(model, DataObject) self.assertEqual(model.getDictValue(), {'test': 'tester'})
def test_root_getDict(self): model = DataObject() model.test = 'tester' self.assertEqual(model.getDictValue(), {'test': 'tester'})
def test_root_get(self): model = DataObject() model.test = 'tester' self.assertEqual(model.__getitem__('test'), 'tester')
def test_root_set(self): model = DataObject() model.test = 'test1' model['test2'] = 'test2' self.assertEqual(model.test, 'test1') self.assertEqual(model.test2, 'test2')
def test_base_add_identifier(self): testRec = DataObject() with self.assertRaises(DataError): testRec.addClassItem('identifiers', Identifier, **{ 'identifier': 1 })
def test_base_dict_create(self): with self.assertRaises(DataError): DataObject.createFromDict(**{ 'test': 'tester', 'count': 1 })
def test_base_set_get(self): testRec = DataObject() testRec['hello'] = 'world' self.assertEqual(testRec['hello'], 'world')
def test_base_create(self): testRec = DataObject() self.assertIsInstance(testRec, DataObject)