def test_crop(col_off, row_off, num_cols, num_rows, height, width): window = Window(col_off, row_off, num_cols, num_rows) cropped_window = crop(window, height, width) assert 0.0 <= round(cropped_window.col_off, 3) <= width assert 0.0 <= round(cropped_window.row_off, 3) <= height assert round(cropped_window.width, 3) <= round(width - cropped_window.col_off, 3) assert round(cropped_window.height, 3) <= round(height - cropped_window.row_off, 3)