Esempio n. 1
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)
Esempio n. 2
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(exceptions.PlotlyError):
         py.get_figure(url)
Esempio n. 3
0
 def test_proper_escaping(self):
     un = 'PlotlyImageTest'
     ak = '786r5mecv0'
     url = "https://plot.ly/~PlotlyImageTest/91/"
     py.sign_in(un, ak)
     print("getting: https://plot.ly/~PlotlyImageTest/91/")
     print("###########################################\n\n")
     fig = py.get_figure(url)
def test_get_figure_with_url():
    un = 'PlotlyImageTest'
    ak = '786r5mecv0'
    url = "https://plot.ly/~PlotlyImageTest/2/"
    py.sign_in(un, ak)
    print("getting: https://plot.ly/~PlotlyImageTest/2/")
    print("###########################################\n\n")
    fig = py.get_figure(url)
def test_get_figure():
    un = 'PlotlyImageTest'
    ak = '786r5mecv0'
    file_id = 2
    py.sign_in(un, ak)
    print("getting: https://plot.ly/~{0}/{1}/".format(un, file_id))
    print("###########################################\n\n")
    fig = py.get_figure('PlotlyImageTest', str(file_id))
Esempio n. 6
0
def test_get_figure_does_not_exist():
    un = 'plotlyimagetest'
    ak = '786r5mecv0'
    url = "https://plot.ly/~PlotlyImageTest/1000000000/"
    py.sign_in(un, ak)
    print("not getting: https://plot.ly/~PlotlyImageTest/1000000000/")
    print("###########################################\n\n")
    fig = py.get_figure(url)
Esempio n. 7
0
def test_get_figure():
    un = 'plotlyimagetest'
    ak = '786r5mecv0'
    file_id = 2
    py.sign_in(un, ak)
    print("getting: https://plot.ly/~{0}/{1}/".format(un, file_id))
    print("###########################################\n\n")
    fig = py.get_figure('plotlyimagetest', str(file_id))
Esempio n. 8
0
def test_get_figure_with_url():
    un = 'plotlyimagetest'
    ak = '786r5mecv0'
    url = "https://plot.ly/~PlotlyImageTest/2/"
    py.sign_in(un, ak)
    print("getting: https://plot.ly/~PlotlyImageTest/2/")
    print("###########################################\n\n")
    fig = py.get_figure(url)
def test_get_figure_does_not_exist():
    un = 'PlotlyImageTest'
    ak = '786r5mecv0'
    url = "https://plot.ly/~PlotlyImageTest/1000000000/"
    py.sign_in(un, ak)
    print("not getting: https://plot.ly/~PlotlyImageTest/1000000000/")
    print("###########################################\n\n")
    fig = py.get_figure(url)
Esempio n. 10
0
def test_get_figure_invalid_2():
    un = 'PlotlyImageTest'
    ak = '786r5mecv0'
    url = "https://plot.ly/~PlotlyImageTest/-1/"
    py.sign_in(un, ak)
    print("not getting: https://plot.ly/~PlotlyImageTest/-1/")
    print("###########################################\n\n")
    fig = py.get_figure(url)
Esempio n. 11
0
def test_update():
    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'] == title
Esempio n. 12
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
Esempio n. 13
0
def test_all():
    un = 'plotlyimagetest'
    ak = '786r5mecv0'
    run_test = False
    end_file = 2
    polar_plots = [],  #[6, 7, 8]
    skip = list(range(0))
    if run_test:
        py.sign_in(un, ak)
        file_id = 0
        while True:
            fig, fig_raw = None, None
            while (file_id in polar_plots) or (file_id in skip):
                print("    skipping: https://plot.ly/~{0}/{1}".format(
                    un, file_id))
                file_id += 1
            print("\n")
            try:
                print("testing: https://plot.ly/~{0}/{1}".format(un, file_id))
                print("###########################################\n\n")
                fig = py.get_figure('plotlyimagetest', str(file_id))
                fig_raw = py.get_figure('plotlyimagetest',
                                        str(file_id),
                                        raw=True)
            except exceptions.PlotlyError:
                pass
            if (fig is None) and (fig_raw is None):
                print("    couldn't find: https://plot.ly/{0}/{1}".format(
                    un, file_id))
            else:
                compare_with_raw(fig, fig_raw, parents=['figure'])
            file_id += 1
            if file_id > end_file:
                break
        raise exceptions.PlotlyError("This error was generated so that the "
                                     "following output is produced...")
Esempio n. 14
0
 def test_plot_valid(self):
     fig = {
         'data': [
             {
                 'x': (1, 2, 3),
                 'y': (2, 1, 2)
             }
         ],
         'layout': {'title': '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'], fig['layout']['title'])
def test_all():
    un = 'PlotlyImageTest'
    ak = '786r5mecv0'
    run_test = False
    end_file = 2
    polar_plots = [],  # [6, 7, 8]
    skip = list(range(0))
    if run_test:
        py.sign_in(un, ak)
        file_id = 0
        while True:
            fig, fig_raw = None, None
            while (file_id in polar_plots) or (file_id in skip):
                print("    skipping: https://plot.ly/~{0}/{1}".format(
                    un, file_id))
                file_id += 1
            print("\n")
            try:
                print("testing: https://plot.ly/~{0}/{1}".format(un, file_id))
                print("###########################################\n\n")
                fig = py.get_figure('PlotlyImageTest', str(file_id))
                fig_raw = py.get_figure('PlotlyImageTest',
                                        str(file_id),
                                        raw=True)
            except exceptions.PlotlyError:
                pass
            if (fig is None) and (fig_raw is None):
                print("    couldn't find: https://plot.ly/{0}/{1}".format(
                    un, file_id))
            else:
                compare_with_raw(fig, fig_raw, parents=['figure'])
            file_id += 1
            if file_id > end_file:
                break
        raise exceptions.PlotlyError("This error was generated so that the "
                                     "following output is produced...")
Esempio n. 16
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)
Esempio n. 17
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))
Esempio n. 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)
Esempio n. 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)