6
6
from matplotlib .testing .decorators import check_figures_equal , image_comparison
7
7
import matplotlib .units as munits
8
8
from matplotlib .category import StrCategoryConverter , UnitData
9
+ from matplotlib .dates import DateConverter
9
10
import numpy as np
10
11
import pytest
11
12
@@ -240,6 +241,7 @@ def test_explicit_converter():
240
241
d1 = {"a" : 1 , "b" : 2 }
241
242
str_cat_converter = StrCategoryConverter ()
242
243
str_cat_converter_2 = StrCategoryConverter ()
244
+ date_converter = DateConverter ()
243
245
244
246
# Explicit is set
245
247
fig1 , ax1 = plt .subplots ()
@@ -254,12 +256,18 @@ def test_explicit_converter():
254
256
with pytest .raises (RuntimeError ):
255
257
ax1 .xaxis .set_converter (str_cat_converter_2 )
256
258
257
- # Warn when implicit overridden
258
259
fig2 , ax2 = plt .subplots ()
259
260
ax2 .plot (d1 .keys (), d1 .values ())
260
261
262
+ # No error when equivalent type is used
263
+ ax2 .xaxis .set_converter (str_cat_converter )
264
+
265
+ fig3 , ax3 = plt .subplots ()
266
+ ax3 .plot (d1 .keys (), d1 .values ())
267
+
268
+ # Warn when implicit overridden
261
269
with pytest .warns ():
262
- ax2 .xaxis .set_converter (str_cat_converter )
270
+ ax3 .xaxis .set_converter (date_converter )
263
271
264
272
265
273
def test_empty_default_limits (quantity_converter ):
0 commit comments