Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34ad36c

Browse files
committed
TST: move all pandas imports to use pd fixture
1 parent d31ec5f commit 34ad36c

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

lib/matplotlib/tests/test_collections.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,7 @@ def test_size_in_xy():
593593
ax.set_ylim(0, 30)
594594

595595

596-
def test_pandas_indexing():
597-
pd = pytest.importorskip('pandas')
596+
def test_pandas_indexing(pd):
598597

599598
# Should not fail break when faced with a
600599
# non-zero indexed series

lib/matplotlib/tests/test_colors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,7 @@ def _azimuth2math(azimuth, elevation):
604604
return theta, phi
605605

606606

607-
def test_pandas_iterable():
608-
pd = pytest.importorskip('pandas')
607+
def test_pandas_iterable(pd):
609608
# Using a list or series yields equivalent
610609
# color maps, i.e the series isn't seen as
611610
# a single color

lib/matplotlib/tests/test_dates.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,9 @@ def tz_convert(dt_list, tzinfo):
552552
_test_date2num_dst(date_range, tz_convert)
553553

554554

555-
def test_date2num_dst_pandas():
555+
def test_date2num_dst_pandas(pd):
556556
# Test for github issue #3896, but in date2num around DST transitions
557557
# with a timezone-aware pandas date_range object.
558-
pd = pytest.importorskip('pandas')
559-
from pandas.tseries import converter
560-
converter.register()
561558

562559
def tz_convert(*args):
563560
return pd.DatetimeIndex.tz_convert(*args).astype(object)

lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ def test_function_call_with_dict_data_not_in_data(func):
162162

163163

164164
@pytest.mark.parametrize('func', all_funcs, ids=all_func_ids)
165-
def test_function_call_with_pandas_data(func):
165+
def test_function_call_with_pandas_data(func, pd):
166166
"""test with pandas dataframe -> label comes from data["col"].name """
167-
pd = pytest.importorskip('pandas')
168-
169167
data = pd.DataFrame({"a": np.array([1, 2], dtype=np.int32),
170168
"b": np.array([8, 9], dtype=np.int32),
171169
"w": ["NOT", "NOT"]})

0 commit comments

Comments
 (0)