@attr('matplotlib')
    def test_default_mpl_plot_generates_expected_html(self):
        # Generate matplotlib plot for tests
        fig = plt.figure()

        x = [10, 20, 30]
        y = [100, 200, 300]
        plt.plot(x, y, "o")

        figure = plotly.tools.mpl_to_plotly(fig)
        data = figure['data']
        layout = figure['layout']
        data_json = json.dumps(data, cls=plotly.utils.PlotlyJSONEncoder)
        layout_json = json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder)
        html = self._read_html(plotly.offline.plot_mpl(fig))

        # just make sure a few of the parts are in here
        # like PlotlyOfflineTestCase(TestCase) in test_core
        self.assertTrue('Plotly.newPlot' in html) # plot command is in there
        self.assertTrue(data_json in html)        # data is in there
        self.assertTrue(layout_json in html)        # layout is in there too
        self.assertTrue(PLOTLYJS in html)         # and the source code
        # and it's an <html> doc
        self.assertTrue(html.startswith('<html>') and html.endswith('</html>'))
dataset/ETHPy150Open plotly/plotly.py/plotly/tests/test_optional/test_offline/test_offline.py/PlotlyOfflineMPLTestCase.test_default_mpl_plot_generates_expected_html/original