Exemple #1
0
    def test_draw_without_maxplotlin(self):
        """Test whether draw raises an error if matplotlib is not installed"""
        maxcut = Maxcut(self.graph)
        from qiskit.exceptions import MissingOptionalLibraryError

        with self.assertRaises(MissingOptionalLibraryError):
            maxcut.draw()
    def test_draw(self):
        """Test whether draw raises an error if matplotlib is not installed"""
        maxcut = Maxcut(self.graph)
        try:
            import matplotlib as _
            maxcut.draw()

        except ImportError:
            with self.assertRaises(MissingOptionalLibraryError):
                maxcut.draw()