def test_get_figure_does_not_exist(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/1000000000/" py.sign_in(un, ak) with self.assertRaises(_plotly_utils.exceptions.PlotlyError): py.get_figure(url)
def test_get_figure_invalid_1(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/a/" py.sign_in(un, ak) with self.assertRaises(exceptions.PlotlyError): py.get_figure(url)
def test_get_figure_invalid_2(self): un = "PlotlyImageTest" ak = "786r5mecv0" url = "https://plot.ly/~PlotlyImageTest/-1/" py.sign_in(un, ak) with self.assertRaises(exceptions.PlotlyError): py.get_figure(url)
def test_get_figure_invalid_2(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/-1/" py.sign_in(un, ak) with self.assertRaises(exceptions.PlotlyError): py.get_figure(url)
def test_get_figure_invalid_3(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/2/" py.sign_in(un, ak) with self.assertRaises(ValueError): py.get_figure(url)
def test_get_figure_invalid_3(self): un = "PlotlyImageTest" ak = "786r5mecv0" url = "https://plot.ly/~PlotlyImageTest/2/" py.sign_in(un, ak) with self.assertRaises(ValueError): py.get_figure(url)
def test_get_figure_does_not_exist(self): un = "PlotlyImageTest" ak = "786r5mecv0" url = "https://plot.ly/~PlotlyImageTest/1000000000/" py.sign_in(un, ak) with self.assertRaises(_plotly_utils.exceptions.PlotlyError): py.get_figure(url)
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_plot_valid(self): fig = { 'data': [ { 'x': (1, 2, 3), 'y': (2, 1, 2) } ], 'layout': {'title': {'text': 'simple'}} } url = py.plot(fig, auto_open=False, filename='plot_valid') saved_fig = py.get_figure(url) self.assertEqual(saved_fig['data'][0]['x'], fig['data'][0]['x']) self.assertEqual(saved_fig['data'][0]['y'], fig['data'][0]['y']) self.assertEqual(saved_fig['layout']['title']['text'], fig['layout']['title']['text'])
def test_plot_valid(self): fig = { 'data': [ { 'x': (1, 2, 3), 'y': (2, 1, 2) } ], 'layout': {'title': {'text': 'simple'}} } url = py.plot(fig, auto_open=False, filename='plot_valid') saved_fig = py.get_figure(url) self.assertEqual(saved_fig['data'][0]['x'], fig['data'][0]['x']) self.assertEqual(saved_fig['data'][0]['y'], fig['data'][0]['y']) self.assertEqual(saved_fig['layout']['title']['text'], fig['layout']['title']['text'])
def test_plot_valid(self): fig = { "data": [{ "x": (1, 2, 3), "y": (2, 1, 2) }], "layout": { "title": { "text": "simple" } }, } url = py.plot(fig, auto_open=False, filename="plot_valid") saved_fig = py.get_figure(url) self.assertEqual(saved_fig["data"][0]["x"], fig["data"][0]["x"]) self.assertEqual(saved_fig["data"][0]["y"], fig["data"][0]["y"]) self.assertEqual(saved_fig["layout"]["title"]["text"], fig["layout"]["title"]["text"])
def test_get_figure_raw(self): un = 'PlotlyImageTest' ak = '786r5mecv0' file_id = 2 py.sign_in(un, ak) py.get_figure('PlotlyImageTest', str(file_id), raw=True)
def test_proper_escaping(self): un = "PlotlyImageTest" ak = "786r5mecv0" url = "https://plot.ly/~PlotlyImageTest/13185/" py.sign_in(un, ak) py.get_figure(url)
def test_proper_escaping(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/13185/" py.sign_in(un, ak) py.get_figure(url)
def test_get_figure(self): un = 'PlotlyImageTest' ak = '786r5mecv0' file_id = 13183 py.sign_in(un, ak) py.get_figure('PlotlyImageTest', str(file_id))
def test_get_figure_raw(self): un = "PlotlyImageTest" ak = "786r5mecv0" file_id = 2 py.sign_in(un, ak) py.get_figure("PlotlyImageTest", str(file_id), raw=True)
def test_get_figure_with_url(self): un = 'PlotlyImageTest' ak = '786r5mecv0' url = "https://plot.ly/~PlotlyImageTest/13183/" py.sign_in(un, ak) py.get_figure(url)
def test_get_figure_raw(self): un = 'PlotlyImageTest' ak = '786r5mecv0' file_id = 2 py.sign_in(un, ak) py.get_figure('PlotlyImageTest', str(file_id), raw=True)
def test_get_figure_with_url(self): un = "PlotlyImageTest" ak = "786r5mecv0" url = "https://plot.ly/~PlotlyImageTest/13183/" py.sign_in(un, ak) py.get_figure(url)
def test_get_figure(self): un = "PlotlyImageTest" ak = "786r5mecv0" file_id = 13183 py.sign_in(un, ak) py.get_figure("PlotlyImageTest", str(file_id))
def test_get_figure(self): un = 'PlotlyImageTest' ak = '786r5mecv0' file_id = 13183 py.sign_in(un, ak) py.get_figure('PlotlyImageTest', str(file_id))