Exemplo n.º 1
0
    def test_graph2(self):
        """
        This test is failing with Python 3.4 if many pictures are drawn.
        """
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        if is_travis_or_appveyor() == "appveyor":
            return

        fix_tkinter_issues_virtualenv()

        from matplotlib import pyplot as plt

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache2")
        stock = StockPrices("BNP.PA", folder=cache)
        stock2 = StockPrices("CA.PA", folder=cache)

        fig, ax = plt.subplots(figsize=(16, 8))
        ax = stock.plot(ax=ax)
        ax = stock2.plot(ax=ax)
        img = os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "temp_image2.png"))
        if os.path.exists(img):
            os.remove(img)
        fig.savefig(img)
        plt.close('all')
        assert os.path.exists(img)
    def test_graph3(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        fix_tkinter_issues_virtualenv()

        from matplotlib import pyplot as plt

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache3")
        stock = StockPrices(TestStockGraph3.tick[0],
                            folder=cache,
                            url=TestStockGraph3.source)
        stock2 = StockPrices(TestStockGraph3.tick[1],
                             folder=cache,
                             url=TestStockGraph3.source)

        fig, ax = plt.subplots(figsize=(16, 8))
        ax = stock.plot(ax=ax)
        ax = stock2.plot(ax=ax, axis=2)
        img = os.path.abspath(
            os.path.join(os.path.split(__file__)[0], "temp_image3.png"))
        if os.path.exists(img):
            os.remove(img)
        fig.savefig(img)
        plt.close('all')
        self.assertExists(img)
Exemplo n.º 3
0
    def test_graph2(self):
        """
        This test is failing with Python 3.4 if many pictures are drawn.
        """
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        if is_travis_or_appveyor() == "appveyor":
            return

        fix_tkinter_issues_virtualenv()

        from matplotlib import pyplot as plt

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache2")
        stock = StockPrices("BNP.PA", folder=cache)
        stock2 = StockPrices("CA.PA", folder=cache)

        fig, ax = plt.subplots(figsize=(16, 8))
        ax = stock.plot(ax=ax)
        ax = stock2.plot(ax=ax)
        img = os.path.abspath(
            os.path.join(os.path.split(__file__)[0], "temp_image2.png"))
        if os.path.exists(img):
            os.remove(img)
        fig.savefig(img)
        plt.close('all')
        assert os.path.exists(img)
Exemplo n.º 4
0
    def test_graph4(self):
        """
        This test is failing with Python 3.4 if many pictures are drawn.
        """
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__")

        fix_tkinter_issues_virtualenv()

        from matplotlib import pyplot as plt

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache4")
        stock = StockPrices(TestStockGraph4.tick,
                            folder=cache,
                            url=TestStockGraph4.source)
        ret = stock.returns()["2012-04-01":"2014-04-15"]

        fig, ax = plt.subplots(figsize=(16, 8))
        ax = stock.plot(ax=ax)
        ax = ret.plot(ax=ax, axis=2)
        img = os.path.abspath(
            os.path.join(os.path.split(__file__)[0], "temp_image4.png"))
        if os.path.exists(img):
            os.remove(img)
        fig.savefig(img)
        plt.close('all')
        self.assertExists(img)
Exemplo n.º 5
0
    def test_graph3(self) :
        """
        This test is failing with Python 3.4 if many pictures are drawn.
        """
        fLOG (__file__, self._testMethodName, OutputPrint = __name__ == "__main__")

        cache = os.path.abspath(os.path.split(__file__)[0])
        cache = os.path.join(cache, "temp_cache3")
        stock = StockPrices ("BNP.PA", folder = cache)
        stock2 = StockPrices ("CA.PA", folder = cache)
                    
        fig, ax, plt = stock.plot(figsize=(16,8))
        fig, ax, plt = stock2.plot(existing=(fig,ax), axis=2)
        img = os.path.abspath(os.path.join(os.path.split(__file__)[0],"temp_image3.png"))
        if os.path.exists(img): os.remove(img)
        fig.savefig(img)
        assert os.path.exists(img)