Skip to content

Commit 4abc4d5

Browse files
authored
Consistently use the load_sample_data function in tests (#1773)
1 parent 4fc86b0 commit 4abc4d5

10 files changed

+23
-23
lines changed

pygmt/tests/test_blockm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
import pytest
1010
import xarray as xr
1111
from pygmt import blockmean, blockmode
12-
from pygmt.datasets import load_sample_bathymetry
12+
from pygmt.datasets import load_sample_data
1313
from pygmt.exceptions import GMTInvalidInput
1414
from pygmt.helpers import GMTTempFile, data_kind
1515

1616

1717
@pytest.fixture(scope="module", name="dataframe")
1818
def fixture_dataframe():
1919
"""
20-
Load the grid data from the sample earth_relief file.
20+
Load the table data from the sample bathymetry dataset.
2121
"""
22-
return load_sample_bathymetry()
22+
return load_sample_data(name="bathymetry")
2323

2424

2525
def test_blockmean_input_dataframe(dataframe):

pygmt/tests/test_blockmedian.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
import pandas as pd
88
import pytest
99
from pygmt import blockmedian
10-
from pygmt.datasets import load_sample_bathymetry
10+
from pygmt.datasets import load_sample_data
1111
from pygmt.exceptions import GMTInvalidInput
1212
from pygmt.helpers import GMTTempFile, data_kind
1313

1414

1515
@pytest.fixture(scope="module", name="dataframe")
1616
def fixture_dataframe():
1717
"""
18-
Load the grid data from the sample earth_relief file.
18+
Load the table data from the sample bathymetry dataset.
1919
"""
20-
return load_sample_bathymetry()
20+
return load_sample_data(name="bathymetry")
2121

2222

2323
def test_blockmedian_input_dataframe(dataframe):

pygmt/tests/test_grdimage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ def test_grdimage_grid_and_shading_with_xarray(grid, xrgrid):
134134
"""
135135
fig_ref, fig_test = Figure(), Figure()
136136
fig_ref.grdimage(
137-
grid="@earth_relief_01d_g", region="GL", cmap="geo", shading=xrgrid, verbose="i"
137+
grid="@earth_relief_01d_g", region="GL", cmap="geo", shading=xrgrid
138138
)
139139
fig_ref.colorbar()
140-
fig_test.grdimage(grid=grid, region="GL", cmap="geo", shading=xrgrid, verbose="i")
140+
fig_test.grdimage(grid=grid, region="GL", cmap="geo", shading=xrgrid)
141141
fig_test.colorbar()
142142
return fig_ref, fig_test
143143

pygmt/tests/test_grdtrack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pandas as pd
88
import pytest
99
from pygmt import grdtrack, which
10-
from pygmt.datasets import load_earth_relief, load_ocean_ridge_points
10+
from pygmt.datasets import load_earth_relief, load_sample_data
1111
from pygmt.exceptions import GMTInvalidInput
1212
from pygmt.helpers import data_kind
1313

@@ -30,7 +30,7 @@ def fixture_dataframe():
3030
"""
3131
Load the ocean ridge file.
3232
"""
33-
return load_ocean_ridge_points()
33+
return load_sample_data(name="ocean_ridge_points")
3434

3535

3636
@pytest.fixture(scope="module", name="csvfile")

pygmt/tests/test_nearneighbor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
import pytest
99
import xarray as xr
1010
from pygmt import nearneighbor
11-
from pygmt.datasets import load_sample_bathymetry
11+
from pygmt.datasets import load_sample_data
1212
from pygmt.exceptions import GMTInvalidInput
1313
from pygmt.helpers import GMTTempFile, data_kind
1414

1515

1616
@pytest.fixture(scope="module", name="ship_data")
1717
def fixture_ship_data():
1818
"""
19-
Load the data from the sample bathymetry dataset.
19+
Load the table data from the sample bathymetry dataset.
2020
"""
21-
return load_sample_bathymetry()
21+
return load_sample_data(name="bathymetry")
2222

2323

2424
@pytest.mark.parametrize("array_func", [np.array, xr.Dataset])

pygmt/tests/test_rose.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55
import pytest
66
from pygmt import Figure
7-
from pygmt.datasets import load_fractures_compilation
7+
from pygmt.datasets import load_sample_data
88

99

1010
@pytest.fixture(scope="module", name="data")
@@ -25,7 +25,7 @@ def fixture_data_fractures_compilation():
2525
2626
Lengths are stored in the first column, azimuths in the second.
2727
"""
28-
return load_fractures_compilation()
28+
return load_sample_data(name="fractures")
2929

3030

3131
@pytest.mark.mpl_image_compare

pygmt/tests/test_select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pandas as pd
88
import pytest
99
from pygmt import select
10-
from pygmt.datasets import load_sample_bathymetry
10+
from pygmt.datasets import load_sample_data
1111
from pygmt.helpers import GMTTempFile
1212

1313

@@ -16,7 +16,7 @@ def fixture_dataframe():
1616
"""
1717
Load the table data from the sample bathymetry dataset.
1818
"""
19-
return load_sample_bathymetry()
19+
return load_sample_data(name="bathymetry")
2020

2121

2222
def test_select_input_dataframe(dataframe):

pygmt/tests/test_sphinterpolate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
import numpy.testing as npt
77
import pytest
88
from pygmt import sphinterpolate
9-
from pygmt.datasets import load_mars_shape
9+
from pygmt.datasets import load_sample_data
1010
from pygmt.helpers import GMTTempFile
1111

1212

1313
@pytest.fixture(scope="module", name="mars")
1414
def fixture_mars_shape():
1515
"""
16-
Load the data from the sample bathymetry dataset.
16+
Load the table data for the shape of Mars.
1717
"""
18-
return load_mars_shape()
18+
return load_sample_data(name="mars_shape")
1919

2020

2121
def test_sphinterpolate_outgrid(mars):

pygmt/tests/test_x2sys_cross.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pandas as pd
1111
import pytest
1212
from pygmt import x2sys_cross, x2sys_init
13-
from pygmt.datasets import load_sample_bathymetry
13+
from pygmt.datasets import load_sample_data
1414
from pygmt.exceptions import GMTInvalidInput
1515
from pygmt.helpers import data_kind
1616

@@ -29,7 +29,7 @@ def fixture_tracks():
2929
"""
3030
Load track data from the sample bathymetry file.
3131
"""
32-
dataframe = load_sample_bathymetry()
32+
dataframe = load_sample_data(name="bathymetry")
3333
dataframe.columns = ["x", "y", "z"] # longitude, latitude, bathymetry
3434
return [dataframe.query(expr="z > -20")] # reduce size of dataset
3535

pygmt/tests/test_xyz2grd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@pytest.fixture(scope="module", name="ship_data")
1515
def fixture_ship_data():
1616
"""
17-
Load the data from the sample bathymetry dataset.
17+
Load the table data from the sample bathymetry dataset.
1818
"""
1919
return load_sample_data(name="bathymetry")
2020

0 commit comments

Comments
 (0)