Skip to content

Commit

Permalink
Figure.contour: Remove parameter "columns", use "incols" instead
Browse files Browse the repository at this point in the history
Also modified the original deprecation test into a regression test for #1313
  • Loading branch information
weiji14 committed Mar 12, 2022
1 parent d85bfdf commit 13dca89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion pygmt/src/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


@fmt_docstring
@deprecate_parameter("columns", "incols", "v0.4.0", remove_version="v0.6.0")
@check_data_input_order("v0.5.0", remove_version="v0.7.0")
@use_alias(
A="annotation",
Expand Down
27 changes: 14 additions & 13 deletions pygmt/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ def test_contour_from_file(region):


@pytest.mark.mpl_image_compare(filename="test_contour_vec.png")
def test_contour_deprecate_columns_to_incols(region):
def test_contour_incols_transposed_data(region):
"""
Make sure that the old parameter "columns" is supported and it reports an
warning.
Make sure that transposing the data matrix still produces a correct result
with incols reordering the columns.
This is a regression test for
https://github.com/GenericMappingTools/pygmt/issues/1313
Modified from the test_contour_vec() test.
"""
Expand All @@ -96,14 +99,12 @@ def test_contour_deprecate_columns_to_incols(region):
# switch x and y from here onwards to simulate different column order
data = np.array([y, x, z]).T

with pytest.warns(expected_warning=FutureWarning) as record:
fig.contour(
data,
projection="X10c",
region=region,
frame="a",
pen=True,
columns=[1, 0, 2],
)
assert len(record) == 1 # check that only one warning was raised
fig.contour(
data,
projection="X10c",
region=region,
frame="a",
pen=True,
incols=[1, 0, 2],
)
return fig

0 comments on commit 13dca89

Please sign in to comment.