forked from plotly/plotly.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_plot.py
More file actions
101 lines (70 loc) · 1.79 KB
/
test_plot.py
File metadata and controls
101 lines (70 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"""
test_plot:
==========
A module intended for use with Nose.
"""
from __future__ import absolute_import
from nose.tools import raises
from unittest import TestCase
from plotly.graph_objs import graph_objs
from plotly.plotly import plotly as py
from plotly.exceptions import PlotlyError, PlotlyEmptyDataError
# username for tests: 'PlotlyImageTest'
# api_key for account: '786r5mecv0'
def setUp():
py.sign_in('PlotlyImageTest', '786r5mecv0',
plotly_domain='https://plot.ly')
def test_plot_valid():
fig = {
'data':[
{
'x':[1,2,3],
'y':[2,1,2]
}
]
}
url = py.plot(fig, auto_open=False, filename='plot_valid')
@raises(PlotlyError)
def test_plot_invalid():
fig = {
'data':[
{
'x':[1,2,3],
'y':[2,1,2],
'z':[3,4,1]
}
]
}
url = py.plot(fig, auto_open=False, filename='plot_invalid')
@raises(TypeError)
def test_plot_invalid_args_1():
url = py.plot(x=[1,2,3],
y=[2,1,2],
auto_open=False,
filename='plot_invalid')
@raises(PlotlyError)
def test_plot_invalid_args_2():
url = py.plot([1,2,3], [2,1,2],
auto_open=False,
filename='plot_invalid')
class TestPlot(TestCase):
def test_plot_empty_data(self):
py.sign_in('PlotlyImageTest', '786r5mecv0')
self.assertRaises(PlotlyEmptyDataError, py.plot, [],
filename='plot_invalid')
def test_bar():
pass
def test_box():
pass
def test_contour():
pass
def test_heatmap():
pass
def test_histogram():
pass
def test_histogram2d():
pass
def test_histogram2dcontour():
pass
def test_plot_scatter():
pass