()
| 239 | |
| 240 | |
| 241 | def test_explicit_converter(): |
| 242 | d1 = {"a": 1, "b": 2} |
| 243 | str_cat_converter = StrCategoryConverter() |
| 244 | str_cat_converter_2 = StrCategoryConverter() |
| 245 | date_converter = DateConverter() |
| 246 | |
| 247 | # Explicit is set |
| 248 | fig1, ax1 = plt.subplots() |
| 249 | ax1.xaxis.set_converter(str_cat_converter) |
| 250 | assert ax1.xaxis.get_converter() == str_cat_converter |
| 251 | # Explicit not overridden by implicit |
| 252 | ax1.plot(d1.keys(), d1.values()) |
| 253 | assert ax1.xaxis.get_converter() == str_cat_converter |
| 254 | # No error when called twice with equivalent input |
| 255 | ax1.xaxis.set_converter(str_cat_converter) |
| 256 | # Error when explicit called twice |
| 257 | with pytest.raises(RuntimeError): |
| 258 | ax1.xaxis.set_converter(str_cat_converter_2) |
| 259 | |
| 260 | fig2, ax2 = plt.subplots() |
| 261 | ax2.plot(d1.keys(), d1.values()) |
| 262 | |
| 263 | # No error when equivalent type is used |
| 264 | ax2.xaxis.set_converter(str_cat_converter) |
| 265 | |
| 266 | fig3, ax3 = plt.subplots() |
| 267 | ax3.plot(d1.keys(), d1.values()) |
| 268 | |
| 269 | # Warn when implicit overridden |
| 270 | with pytest.warns(): |
| 271 | ax3.xaxis.set_converter(date_converter) |
| 272 | |
| 273 | |
| 274 | def test_empty_default_limits(quantity_converter): |
nothing calls this directly
no test coverage detected
searching dependent graphs…