def test_setitem_non_ndarray(self): dataStructure = DataStructure(self.dataManager, 5) dataEntry = DataEntry('parameters', 3) dataStructure.createEntry('parameters', dataEntry) self.assertRaises(ValueError, dataStructure.__setitem__, 'parameters', None)
def test_createEntry_twice(self): dataStructure = DataStructure(self.dataManager, 5) dataEntry = DataEntry('parameters', 3) dataStructure.createEntry('parameters', dataEntry) self.assertRaises(ValueError, dataStructure.createEntry, 'parameters', dataEntry)
def test_len(self): dataStructure = DataStructure(self.dataManager, 5) self.assertEqual(len(dataStructure), 0) dataEntry = DataEntry('parameters', 3) dataStructure.createEntry('parameters', dataEntry) self.assertEqual(len(dataStructure), 1)
def test_getDataEntry_invalid_indices_type(self): dataStructure = DataStructure(self.dataManager, 5) dataStructure.createEntry('parameters', DataEntry('parameters', 3)) data = None self.assertRaises(ValueError, dataStructure.getDataEntry, data, ['parameters'], 'x')
def test_setitem_invalid_shape(self): dataStructure = DataStructure(self.dataManager, 5) dataStructure.createEntry('parameters', DataEntry('parameters', 3)) self.assertRaises(ValueError, dataStructure.__setitem__, 'parameters', np.ndarray((1, 2)))
def test_contains(self): dataStructure = DataStructure(self.dataManager, 5) dataEntry = DataEntry('parameters', 3) dataStructure.createEntry('parameters', dataEntry) self.assertEqual('parameters' in dataStructure, True) self.assertEqual('praamteres' in dataStructure, False)