Skip to content

Commit 3109ce9

Browse files
committed
MAINT: Updated tick and category test formatting
1 parent 924d913 commit 3109ce9

File tree

3 files changed

+470
-429
lines changed

3 files changed

+470
-429
lines changed

lib/matplotlib/tests/test_category.py

+21-13
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,25 @@ def lt(tl):
121121

122122

123123
class TestPlot(object):
124+
bytes_data = [
125+
['a', 'b', 'c'],
126+
[b'a', b'b', b'c'],
127+
np.array([b'a', b'b', b'c'])
128+
]
129+
130+
bytes_ids = ['string list', 'bytes list', 'bytes ndarray']
131+
132+
numlike_data = [
133+
['1', '11', '3'],
134+
np.array(['1', '11', '3']),
135+
[b'1', b'11', b'3'],
136+
np.array([b'1', b'11', b'3']),
137+
]
138+
139+
numlike_ids = [
140+
'string list', 'string ndarray', 'bytes list', 'bytes ndarray'
141+
]
142+
124143
@pytest.fixture
125144
def data(self):
126145
self.d = ['a', 'b', 'c', 'a']
@@ -171,12 +190,7 @@ def test_plot_1d_missing(self):
171190
self.axis_test(ax.yaxis, self.dmticks, self.dmlabels, self.dmunit_data)
172191

173192
@pytest.mark.usefixtures("data")
174-
@pytest.mark.parametrize("bars",
175-
[['a', 'b', 'c'],
176-
[b'a', b'b', b'c'],
177-
np.array([b'a', b'b', b'c'])],
178-
ids=['string list', 'bytes list',
179-
'bytes ndarray'])
193+
@pytest.mark.parametrize("bars", bytes_data, ids=bytes_ids)
180194
def test_plot_bytes(self, bars):
181195
counts = np.array([4, 6, 5])
182196

@@ -186,13 +200,7 @@ def test_plot_bytes(self, bars):
186200

187201
self.axis_test(ax.xaxis, self.dticks, self.dlabels, self.dunit_data)
188202

189-
@pytest.mark.parametrize("bars",
190-
[['1', '11', '3'],
191-
np.array(['1', '11', '3']),
192-
[b'1', b'11', b'3'],
193-
np.array([b'1', b'11', b'3'])],
194-
ids=['string list', 'string ndarray',
195-
'bytes list', 'bytes ndarray'])
203+
@pytest.mark.parametrize("bars", numlike_data, ids=numlike_ids)
196204
def test_plot_numlike(self, bars):
197205
counts = np.array([4, 6, 5])
198206

0 commit comments

Comments
 (0)