Skip to content

Commit 488a31d

Browse files
committed
Adding a test for passing backend option in plot
1 parent 0991a39 commit 488a31d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pandas/tests/plotting/test_backend.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pandas
1010

1111
dummy_backend = types.ModuleType("pandas_dummy_backend")
12-
dummy_backend.plot = lambda *args, **kwargs: None
12+
dummy_backend.plot = lambda *args, **kwargs: 'used_dummy'
1313

1414

1515
@pytest.fixture
@@ -38,6 +38,16 @@ def test_backend_is_correct(monkeypatch, restore_backend):
3838
)
3939

4040

41+
def test_backend_can_be_set_in_plot_call(monkeypatch, restore_backend):
42+
monkeypatch.setitem(sys.modules, "pandas_dummy_backend", dummy_backend)
43+
df = pandas.DataFrame([1,2,3])
44+
45+
assert pandas.get_option("plotting.backend") == "matplotlib"
46+
assert (
47+
df.plot(backend='pandas_dummy_backend') == 'used_dummy'
48+
)
49+
50+
4151
@td.skip_if_no_mpl
4252
def test_register_entrypoint(restore_backend):
4353

0 commit comments

Comments
 (0)