def test_missing_end_values(self): out = make_downshift_arrays(np.array([0, 0, 1, 1, 2, 2]), 4) self.assert_rows_match(out, np.array([np.array([0, 1]), np.array([2, 3]), np.array([4, 5]), np.array([], dtype=np.int), None], dtype=object))
def test_missing_intra_values_2(self): out = make_downshift_arrays( np.array([0, 0, 3, 3, 4, 4]), 5) self.assert_rows_match(out, np.array([np.array([0, 1]), np.array([], dtype=np.int), np.array([], dtype=np.int), np.array([2, 3]), np.array([4, 5]), None], dtype=object))
def test_missing_end_values(self): out = make_downshift_arrays(np.array([0, 0, 1, 1, 2, 2]), 4) self.assert_rows_match( out, np.array([ np.array([0, 1]), np.array([2, 3]), np.array([4, 5]), np.array([], dtype=int), None ], dtype=object))
def test_missing_intra_values_2(self): out = make_downshift_arrays(np.array([0, 0, 3, 3, 4, 4]), 5) self.assert_rows_match( out, np.array([ np.array([0, 1]), np.array([], dtype=int), np.array([], dtype=int), np.array([2, 3]), np.array([4, 5]), None ], dtype=object))
def test_contents_ragged(self, ragged, ragged_size, ragged_result): out = make_downshift_arrays(ragged, ragged_size) self.assert_rows_match(out, ragged_result)
def test_downshift_dtype_ragged(self): out = make_downshift_arrays(self.ragged, self.ragged_size) assert_(out.dtype == object) assert_(out[0].dtype == np.intp)
def test_contents_square(self): out = make_downshift_arrays(self.square, self.square_size) self.assert_rows_match(out, self.square_result)
def test_shape_square(self): out = make_downshift_arrays(self.square, self.square_size) assert_(out.shape == (4,)) assert_(out[-1] is None)
def test_downshift_dtype_square(self, square, square_size): out = make_downshift_arrays(square, square_size) assert out.dtype == object assert out[0].dtype == np.intp
def test_shape_ragged(self, ragged, ragged_size): out = make_downshift_arrays(ragged, ragged_size) assert out.shape == (4,) assert out[-1] is None
def test_shape_square(self, square, square_size): out = make_downshift_arrays(square, square_size) assert out.shape == (4,) assert out[-1] is None
def test_downshift_dtype_ragged(self, ragged, ragged_size): out = make_downshift_arrays(ragged, ragged_size) assert out.dtype == object assert out[0].dtype == np.intp
def test_shape_ragged(self): out = make_downshift_arrays(self.ragged, self.ragged_size) assert_(out.shape == (4, )) assert_(out[-1] is None)
def test_shape_square(self): out = make_downshift_arrays(self.square, self.square_size) assert_(out.shape == (4, )) assert_(out[-1] is None)
def test_downshift_dtype_square(self): out = make_downshift_arrays(self.square, self.square_size) assert_(out.dtype == object) assert_(out[0].dtype == np.int64)
def test_downshift_dtype_ragged(self): out = make_downshift_arrays(self.ragged, self.ragged_size) assert_(out.dtype == object) assert_(out[0].dtype == np.int64)
def test_shape_ragged(self): out = make_downshift_arrays(self.ragged, self.ragged_size) assert_(out.shape == (4,)) assert_(out[-1] is None)
def test_shape_square(self, square, square_size): out = make_downshift_arrays(square, square_size) assert out.shape == (4, ) assert out[-1] is None
def test_contents_ragged(self): out = make_downshift_arrays(self.ragged, self.ragged_size) self.assert_rows_match(out, self.ragged_result)
def test_shape_ragged(self, ragged, ragged_size): out = make_downshift_arrays(ragged, ragged_size) assert out.shape == (4, ) assert out[-1] is None
def test_contents_square(self, square, square_size, square_result): out = make_downshift_arrays(square, square_size) self.assert_rows_match(out, square_result)
def test_downshift_dtype_square(self): out = make_downshift_arrays(self.square, self.square_size) assert_(out.dtype == object) assert_(out[0].dtype == np.intp)