@@ -56,22 +56,23 @@ def test_default_plot_generates_expected_html(self):
56
56
57
57
# I don't really want to test the entire script output, so
58
58
# instead just make sure a few of the parts are in here?
59
- self .assertTrue ('Plotly.newPlot' in html ) # plot command is in there
60
- self .assertTrue (data_json in html ) # data is in there
61
- self .assertTrue (layout_json in html ) # so is layout
62
- self .assertTrue (PLOTLYJS in html ) # and the source code
59
+ self .assertIn ('Plotly.newPlot' , html ) # plot command is in there
60
+ self .assertIn (data_json , html ) # data is in there
61
+ self .assertIn (layout_json , html ) # so is layout
62
+ self .assertIn (PLOTLYJS , html ) # and the source code
63
63
# and it's an <html> doc
64
64
self .assertTrue (html .startswith ('<html>' ) and html .endswith ('</html>' ))
65
65
66
66
def test_including_plotlyjs (self ):
67
67
html = self ._read_html (plotly .offline .plot (fig , include_plotlyjs = False ,
68
68
auto_open = False ))
69
- self .assertTrue (PLOTLYJS not in html )
69
+ self .assertNotIn (PLOTLYJS , html )
70
70
71
71
def test_div_output (self ):
72
72
html = plotly .offline .plot (fig , output_type = 'div' , auto_open = False )
73
73
74
- self .assertTrue ('<html>' not in html and '</html>' not in html )
74
+ self .assertNotIn ('<html>' , html )
75
+ self .assertNotIn ('</html>' , html )
75
76
self .assertTrue (html .startswith ('<div>' ) and html .endswith ('</div>' ))
76
77
77
78
def test_autoresizing (self ):
@@ -82,7 +83,7 @@ def test_autoresizing(self):
82
83
# If width or height wasn't specified, then we add a window resizer
83
84
html = self ._read_html (plotly .offline .plot (fig , auto_open = False ))
84
85
for resize_code_string in resize_code_strings :
85
- self .assertTrue (resize_code_string in html )
86
+ self .assertIn (resize_code_string , html )
86
87
87
88
# If width or height was specified, then we don't resize
88
89
html = self ._read_html (plotly .offline .plot ({
@@ -92,7 +93,7 @@ def test_autoresizing(self):
92
93
}
93
94
}, auto_open = False ))
94
95
for resize_code_string in resize_code_strings :
95
- self .assertTrue (resize_code_string not in html )
96
+ self .assertNotIn (resize_code_string , html )
96
97
97
98
def test_config (self ):
98
99
config = dict (linkText = 'Plotly rocks!' ,
@@ -115,7 +116,7 @@ def test_plot_rendered_if_non_plotly_domain(self):
115
116
html = plotly .offline .plot (fig , output_type = 'div' )
116
117
117
118
# test that 'Export to stage.plot.ly' is in the html
118
- self .assertTrue ('Export to stage.plot.ly' in html )
119
+ self .assertIn ('Export to stage.plot.ly' , html )
119
120
120
121
def tearDown (self ):
121
122
plotly .tools .set_config_file (plotly_domain = 'https://plot.ly' ,
0 commit comments