def test_neither(self): p = figure(plot_width=200, plot_height=300) d = Document() d.add_root(p) util.set_single_plot_width_height(d, None, None) assert p.plot_width == 200 assert p.plot_height == 300
def test_both(self): p = figure(plot_width=200, plot_height=300) d = Document() d.add_root(p) util.set_single_plot_width_height(d, 400, 500) assert p.plot_width == 400 assert p.plot_height == 500
def test_width(self): p = figure(plot_width=200, plot_height=300) d = Document() d.add_root(p) util.set_single_plot_width_height(d, 400, None) assert p.plot_width == 400 assert p.plot_height == 300
def test_layout(self): p = figure(plot_width=200, plot_height=300) d = Document() d.add_root(row(p)) with pytest.warns(UserWarning) as warns: util.set_single_plot_width_height(d, 400, 500) assert len(warns) == 1 assert warns[0].message.args[0] == _SIZE_WARNING
def test_multiple_roots(self) -> None: p1 = figure(plot_width=200, plot_height=300) p2 = figure(plot_width=200, plot_height=300) d = Document() d.add_root(p1) d.add_root(p2) with pytest.warns(UserWarning) as warns: util.set_single_plot_width_height(d, 400, 500) assert len(warns) == 1 assert warns[0].message.args[0] == _SIZE_WARNING