Skip to content

Commit f9f2cb1

Browse files
committed
MAINT: Updated tick and category test formatting
1 parent f858cc5 commit f9f2cb1

File tree

3 files changed

+471
-429
lines changed

3 files changed

+471
-429
lines changed

lib/matplotlib/tests/test_category.py

Lines changed: 21 additions & 13 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy