def test_minimize_decompression(self): arr = id.integer_minimize_decompression( np.array([1, 2, 3, 4, 5], dtype=np.uint8), cd.IntegerMinimizeTransformation(1000) ) self.validate_minimize_decompression(arr) return
def test_integer_minimize_transform(self): t = c.IntegerMinimizeTransformation(1) self.assertEqual(c.IntegerTransformTypes.MINIMIZE, t.transform_type) self.assertEqual(1, t.reference_value) ts = '{}'.format(t) self.assertTrue('reference_value=' in ts) return
def test_integer_catch_all_fail(self): transform = cd.IntegerMinimizeTransformation(0) transform.transform_type = None with self.assertRaises(ValueError): id.integer_decompression_from_transform( np.array([], dtype=np.int8), transform ) return
def test_integer_transform_list(self): arr = id.integer_decompression_from_transforms( np.array([1, 0, 1, 0], dtype=np.uint8), [ cd.IntegerElementWiseTransformation(1000), cd.IntegerMinimizeTransformation(100) ] ) self.assertEqual(1100, arr[0]) self.assertEqual(1101, arr[1]) self.assertEqual(1101, arr[2]) self.assertEqual(1102, arr[3]) self.assertEqual(1102, arr[4]) return
def test_integer_catch_all(self): arr = id.integer_decompression_from_transform( np.array([1, 2, 3, 4, 5], dtype=np.uint8), cd.IntegerMinimizeTransformation(1000) ) self.validate_minimize_decompression(arr) arr = id.integer_decompression_from_transform( np.array([1, 0, 1, 0], dtype=np.uint8), cd.IntegerElementWiseTransformation(1000) ) self.validate_elem_decompression(arr) arr = id.integer_decompression_from_transform( np.array([1, 1, 0, 2], dtype=np.uint8), cd.IntegerHashTransformation( key_values=np.array([0, -1000, 1000], dtype=np.int16), key_value_type=t.NumpyType(t.NumpyKinds.INTEGER, t.NumpySizes.SHORT) ) ) self.validate_hash_decompression(arr) return