示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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
示例#9
0
 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
示例#10
0
 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'])
示例#11
0
 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'])
示例#12
0
 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"])
示例#13
0
 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)
示例#14
0
 def test_proper_escaping(self):
     un = "PlotlyImageTest"
     ak = "786r5mecv0"
     url = "https://plot.ly/~PlotlyImageTest/13185/"
     py.sign_in(un, ak)
     py.get_figure(url)
示例#15
0
 def test_proper_escaping(self):
     un = 'PlotlyImageTest'
     ak = '786r5mecv0'
     url = "https://plot.ly/~PlotlyImageTest/13185/"
     py.sign_in(un, ak)
     py.get_figure(url)
示例#16
0
 def test_get_figure(self):
     un = 'PlotlyImageTest'
     ak = '786r5mecv0'
     file_id = 13183
     py.sign_in(un, ak)
     py.get_figure('PlotlyImageTest', str(file_id))
示例#17
0
 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)
示例#18
0
 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)
示例#19
0
 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)
示例#20
0
 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)
示例#21
0
 def test_get_figure(self):
     un = "PlotlyImageTest"
     ak = "786r5mecv0"
     file_id = 13183
     py.sign_in(un, ak)
     py.get_figure("PlotlyImageTest", str(file_id))
示例#22
0
 def test_get_figure(self):
     un = 'PlotlyImageTest'
     ak = '786r5mecv0'
     file_id = 13183
     py.sign_in(un, ak)
     py.get_figure('PlotlyImageTest', str(file_id))