def testFillArrayLarge(self): a = (np.ones(shape=[8, 8, 8, 8, 32], dtype=np.int32).tolist() + np.ones(shape=[8, 8, 8, 8, 36], dtype=np.int32).tolist()) actual = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32) ff._fill_array(actual, a) expected = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32) expected[:8, ..., 32:] = 0 self.assertEqual(expected.tolist(), actual.tolist())
def testFillArraySmall(self): a = (np.ones(shape=[32, 32], dtype=np.int32).tolist() + np.ones(shape=[32, 36], dtype=np.int32).tolist()) actual = np.ones(shape=[64, 36], dtype=np.int32) ff._fill_array(actual, a) expected = np.ones(shape=[64, 36], dtype=np.int32) expected[:32, 32:] = 0 self.assertEqual(expected.tolist(), actual.tolist())
def testFillArrayLargeWithSpecifiedValue(self): fill_value = 8 a = (np.ones(shape=[8, 8, 8, 8, 32], dtype=np.int32).tolist() + np.ones(shape=[8, 8, 8, 8, 36], dtype=np.int32).tolist()) actual = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32) ff._fill_array(actual, a, fill_value) expected = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32) expected[:8, ..., 32:] = fill_value self.assertEqual(expected.tolist(), actual.tolist())