Skip to content

Commit

Permalink
Simplify to remove getattr(pa, "array", None) call
Browse files Browse the repository at this point in the history
Co-Authored-By: Dongdong Tian <[email protected]>
  • Loading branch information
weiji14 and seisman committed Nov 15, 2024
1 parent edb3438 commit 8172102
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 5 additions & 3 deletions pygmt/tests/test_clib_virtualfile_from_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@

try:
import pyarrow as pa

pa_array = pa.array
except ImportError:
pa = None
pa_array = None


@pytest.fixture(scope="module", name="dtypes")
Expand Down Expand Up @@ -65,8 +67,8 @@ def test_virtualfile_from_vectors(dtypes):
pytest.param(np.array, {"dtype": np.str_}, id="str"),
pytest.param(np.array, {"dtype": np.object_}, id="object"),
pytest.param(
getattr(pa, "array", None),
{}, # pa.string()
pa_array,
{}, # {"type": pa.string()}
marks=skip_if_no(package="pyarrow"),
id="pyarrow",
),
Expand Down
10 changes: 4 additions & 6 deletions pygmt/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

try:
import pyarrow as pa

pa_array = pa.array
except ImportError:
pa = None
pa_array = None

TEST_DATA_DIR = Path(__file__).parent / "data"
POINTS_DATA = TEST_DATA_DIR / "points.txt"
Expand Down Expand Up @@ -60,11 +62,7 @@ def test_text_single_line_of_text(region, projection):
[
list,
pytest.param(np.array, id="numpy"),
pytest.param(
getattr(pa, "array", None),
marks=skip_if_no(package="pyarrow"),
id="pyarrow",
),
pytest.param(pa_array, marks=skip_if_no(package="pyarrow"), id="pyarrow"),
],
)
def test_text_multiple_lines_of_text(region, projection, array_func):
Expand Down

0 comments on commit 8172102

Please sign in to comment.