File tree Expand file tree Collapse file tree 3 files changed +18
-22
lines changed
plotly/tests/test_core/test_graph_objs Expand file tree Collapse file tree 3 files changed +18
-22
lines changed Original file line number Diff line number Diff line change 6
6
7
7
"""
8
8
from __future__ import absolute_import
9
+ import warnings
9
10
10
11
from nose .tools import raises
11
12
from plotly .graph_objs import *
@@ -34,14 +35,10 @@ def test_dict_instantiation():
34
35
Annotations ([{'text' : 'annotation text' }])
35
36
36
37
37
- @raises (PlotlyDictKeyError )
38
38
def test_dict_instantiation_key_error ():
39
- print (Annotations ([{'not-a-key' : 'anything' }]))
40
-
41
-
42
- @raises (PlotlyDictValueError )
43
- def test_dict_instantiation_key_error ():
44
- print (Annotations ([{'font' : 'not-a-dict' }]))
39
+ with warnings .catch_warnings (True ) as w :
40
+ print (Annotations ([{'not-a-key' : 'anything' }]))
41
+ assert (len (w ) > 1 )
45
42
46
43
47
44
@raises (PlotlyListEntryError )
@@ -73,9 +70,9 @@ def test_validate():
73
70
annotations .validate ()
74
71
75
72
76
- @raises (PlotlyDictKeyError )
77
73
def test_validate_error ():
78
74
annotations = Annotations ()
79
75
annotations .append ({'not-a-key' : 'anything' })
80
- annotations .validate ()
81
-
76
+ with warnings .catch_warnings (True ) as w :
77
+ annotations .validate ()
78
+ assert len (w ) > 1
Original file line number Diff line number Diff line change 6
6
7
7
"""
8
8
from __future__ import absolute_import
9
+ import warnings
9
10
10
11
from nose .tools import raises
11
12
from plotly .graph_objs import *
@@ -38,14 +39,10 @@ def test_dict_instantiation():
38
39
Data ([{'type' : 'scatter' }])
39
40
40
41
41
- @raises (PlotlyDictKeyError )
42
42
def test_dict_instantiation_key_error ():
43
- print (Data ([{'not-a-key' : 'anything' }]))
44
-
45
-
46
- @raises (PlotlyDictValueError )
47
- def test_dict_instantiation_key_error ():
48
- print (Data ([{'marker' : 'not-a-dict' }]))
43
+ with warnings .catch_warnings (True ) as w :
44
+ print (Data ([{'not-a-key' : 'anything' }]))
45
+ assert len (w ) > 1
49
46
50
47
51
48
@raises (PlotlyDataTypeError )
@@ -82,9 +79,9 @@ def test_validate():
82
79
data .validate ()
83
80
84
81
85
- @raises (PlotlyDictKeyError )
86
82
def test_validate_error ():
87
83
data = Data ()
88
84
data .append ({'not-a-key' : 'anything' })
89
- data .validate ()
90
-
85
+ with warnings .catch_warnings (True ) as w :
86
+ data .validate ()
87
+ assert len (w ) > 1
Original file line number Diff line number Diff line change 6
6
7
7
"""
8
8
from __future__ import absolute_import
9
+ import warnings
9
10
10
11
from nose .tools import raises
11
12
from plotly .graph_objs import *
@@ -46,6 +47,7 @@ def test_instantiate_error_y():
46
47
width = 5 )
47
48
48
49
49
- @raises (PlotlyDictKeyError )
50
50
def test_key_error ():
51
- ErrorX (value = 0.1 , typ = 'percent' , color = 'red' )
51
+ with warnings .catch_warnings (True ) as w :
52
+ ErrorX (value = 0.1 , typ = 'percent' , color = 'red' )
53
+ assert len (w ) > 1
You can’t perform that action at this time.
0 commit comments