Skip to content

Commit 6d2c93f

Browse files
committed
MAINT: Updated tick and category test formatting
1 parent 87885e7 commit 6d2c93f

File tree

2 files changed

+452
-406
lines changed

2 files changed

+452
-406
lines changed

lib/matplotlib/tests/test_category.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@ def lt(tl):
122122

123123

124124
class TestPlot(object):
125+
bytes_data = [
126+
['a', 'b', 'c'],
127+
[b'a', b'b', b'c'],
128+
np.array([b'a', b'b', b'c'])
129+
]
130+
131+
bytes_ids = ['string list', 'bytes list', 'bytes ndarray']
132+
133+
numlike_data = [
134+
['1', '11', '3'],
135+
np.array(['1', '11', '3']),
136+
[b'1', b'11', b'3'],
137+
np.array([b'1', b'11', b'3']),
138+
]
139+
140+
numlike_ids=[
141+
'string list', 'string ndarray', 'bytes list', 'bytes ndarray'
142+
]
143+
125144
@pytest.fixture
126145
def data(self):
127146
self.d = ['a', 'b', 'c', 'a']
@@ -176,12 +195,7 @@ def test_plot_1d_missing(self):
176195

177196
@cleanup
178197
@pytest.mark.usefixtures("data")
179-
@pytest.mark.parametrize("bars",
180-
[['a', 'b', 'c'],
181-
[b'a', b'b', b'c'],
182-
np.array([b'a', b'b', b'c'])],
183-
ids=['string list', 'bytes list',
184-
'bytes ndarray'])
198+
@pytest.mark.parametrize("bars", bytes_data, ids=bytes_ids)
185199
def test_plot_bytes(self, bars):
186200
counts = np.array([4, 6, 5])
187201

@@ -192,13 +206,7 @@ def test_plot_bytes(self, bars):
192206
self.axis_test(ax.xaxis, self.dticks, self.dlabels, self.dunit_data)
193207

194208
@cleanup
195-
@pytest.mark.parametrize("bars",
196-
[['1', '11', '3'],
197-
np.array(['1', '11', '3']),
198-
[b'1', b'11', b'3'],
199-
np.array([b'1', b'11', b'3'])],
200-
ids=['string list', 'string ndarray',
201-
'bytes list', 'bytes ndarray'])
209+
@pytest.mark.parametrize("bars", numlike_data, ids=numlike_ids)
202210
def test_plot_numlike(self, bars):
203211
counts = np.array([4, 6, 5])
204212

0 commit comments

Comments
 (0)