66from matplotlib .testing .decorators import check_figures_equal , image_comparison
77import matplotlib .units as munits
88from matplotlib .category import StrCategoryConverter , UnitData
9+ from matplotlib .dates import DateConverter
910import numpy as np
1011import pytest
1112
@@ -240,6 +241,7 @@ def test_explicit_converter():
240241 d1 = {"a" : 1 , "b" : 2 }
241242 str_cat_converter = StrCategoryConverter ()
242243 str_cat_converter_2 = StrCategoryConverter ()
244+ date_converter = DateConverter ()
243245
244246 # Explicit is set
245247 fig1 , ax1 = plt .subplots ()
@@ -254,12 +256,18 @@ def test_explicit_converter():
254256 with pytest .raises (RuntimeError ):
255257 ax1 .xaxis .set_converter (str_cat_converter_2 )
256258
257- # Warn when implicit overridden
258259 fig2 , ax2 = plt .subplots ()
259260 ax2 .plot (d1 .keys (), d1 .values ())
260261
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
261269 with pytest .warns ():
262- ax2 .xaxis .set_converter (str_cat_converter )
270+ ax3 .xaxis .set_converter (date_converter )
263271
264272
265273def test_empty_default_limits (quantity_converter ):
0 commit comments