def test_get_flattened_index(self):
        self.assertEqual(slice(4,5,None), get_flattened_index(4, (10,)))
        self.assertEqual(slice(9,10,None), get_flattened_index(-1, (10,)))
        self.assertEqual(slice(90,100,1), get_flattened_index(-1, (10,10)))
        try:
            self.assertEqual(0, get_flattened_index(10, (10,10)))
        except __HOLE__ as err:
            # Some versions of numpy have slightly different messages, so as
            # long as it is an index error, we are fine.
            pass
        else:
            self.fail('Should get an Indexerror')

        self.assertEqual(slice(22,23,None), get_flattened_index((2,2), (10,10)))
        self.assertEqual(slice(42,63, 10), get_flattened_index((slice(4,7),2), (10,10)))
        self.assertEqual(slice(40,61,10), get_flattened_index((slice(4,7),0), (10,10)))
        self.assertEqual(slice(4, 11, 2), get_flattened_index(slice(4,11,2), (20,)))
        self.assertEqual(slice(40,50,1),
                          get_flattened_index(slice(4,5,2), (20,10)))

        self.assertEqual(slice(1,2,None), get_flattened_index(1, (5,)))
        self.assertEqual(slice(6,7,None), get_flattened_index([1,2], (3,4)))
        self.assertEqual(slice(62,63,None), get_flattened_index([-1,-1], (9,7)))
        self.assertEqual(slice(3, 25, 7), get_flattened_index([slice(None),3], (4,7)))
        self.assertEqual(slice(48,49,None), get_flattened_index(-2, (50,)))
        self.assertEqual(slice(3, 44, 5), get_flattened_index(slice(3,-3,5), (50,)))
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/test/test_array_helpers.py/TestcaseArrayHelpers.test_get_flattened_index