def test_update_validation_error(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) update = {"invalid": "anything"} with pytest.raises(KeyError): py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False)
def test_update_type_error(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) update = [] with pytest.raises(_plotly_utils.exceptions.PlotlyGraphObjectError): py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False)
def test_update(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) title = "new title" update = {"layout": {"title": title}} url = py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) un = url.replace("https://plot.ly/~", "").split("/")[0] fid = url.replace("https://plot.ly/~", "").split("/")[1] pfig = py.get_figure(un, fid) assert pfig["layout"]["title"]["text"] == title
def test_update(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) title = 'new title' update = {'layout': {'title': title}} url = py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False) un = url.replace("https://plot.ly/~", "").split('/')[0] fid = url.replace("https://plot.ly/~", "").split('/')[1] pfig = py.get_figure(un, fid) assert pfig['layout']['title']['text'] == title
def test_update_type_error(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) update = [] py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False)
def test_update_validation_error(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) update = {'invalid': 'anything'} py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False)
def test_update_type_error(self): fig, ax = plt.subplots() ax.plot([1, 2, 3]) update = [] py.plot_mpl(fig, update=update, filename="nosetests", auto_open=False)