Beispiel #1
0
    def test_is_active(self):
        obs_size = 10
        block = ObsBlock("OBS", obs_size)
        self.assertEqual(obs_size, block.totalSize())
        self.assertEqual(0, block.activeSize())
        for i in range(block.totalSize()):
            self.assertFalse(block.is_active(i))

        active_indexes = [2, 5, 8, 9]
        for index in active_indexes:
            block[index] = (10 * index, index)
        self.assertEqual(obs_size, block.totalSize())
        self.assertEqual(len(active_indexes), block.activeSize())

        for i in active_indexes:
            self.assertTrue(block.is_active(i))

        for i in set(range(block.totalSize())) - set(active_indexes):
            self.assertFalse(block.is_active(i))
Beispiel #2
0
 def test_create(self):
     block = ObsBlock("OBS", 1000)
     self.assertTrue(isinstance(block, ObsBlock))
     self.assertEqual(1000, block.totalSize())
     self.assertEqual(0, block.activeSize())