def test_from_shape_and_to_shape_are_arrays(self): # from/to shape as arrays from_shape = (10, 10, 3) to_shape = (20, 30, 3) observed = _compute_resized_shape(np.zeros(from_shape), np.zeros(to_shape)) assert observed == to_shape
def test_to_shape_is_int_and_float(self): from_shape = (10, 17, 3) to_shape = (15, 2.0) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (15, 34, 3)
def test_to_shape_is_float_and_int(self): # tuple of int and float from_shape = (10, 15, 3) to_shape = (2.0, 25) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 25, 3)
def test_to_shape_is_tuple_of_floats(self): from_shape = (10, 15, 3) to_shape = (2.0, 3.0) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 45, 3)
def test_to_shape_is_tuple_of_ints_3d(self): from_shape = (10, 15, 3) to_shape = (20, 30, 3) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 30, 3)
def test_from_shape_is_2d_and_to_shape_is_3d(self): from_shape = (10, 15) to_shape = (20, 30, 3) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 30, 3)
def test_to_shape_is_float(self): from_shape = (10, 15, 3) to_shape = 2.0 observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 30, 3)
def test_to_shape_is_single_int(self): from_shape = (10, 15, 3) to_shape = 20 observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 20, 3)
def test_to_shape_is_none_and_int(self): from_shape = (10, 15, 3) to_shape = (None, 25) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (10, 25, 3)
def test_to_shape_is_int_and_none(self): from_shape = (10, 15, 3) to_shape = (2.0, None) observed = _compute_resized_shape(from_shape, to_shape) assert observed == (20, 15, 3)
def test_to_shape_is_none(self): from_shape = (10, 10, 3) to_shape = None observed = _compute_resized_shape(from_shape, to_shape) assert observed == from_shape