Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
 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')
Example #5
0
 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)))
Example #6
0
 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)