예제 #1
0
    def test_create_single_unclassified_plot_success(self, mock_figure_class):
        mock_figures = [mock.Mock()]
        mock_figure_class.side_effect = mock_figures

        GlobalFigureManager.get_figure_number()
        self.assertTrue(1 in GlobalFigureManager.all_figure_numbers()) #Check that a new figure with number=1 was created
        self.assertRaises(KeyError, GlobalFigureManager.get_category, 1) #Check that figure has no category
        self.assertTrue(GlobalFigureManager.get_active_figure() == mock_figures[0]) # Check that it is set as the active figure
예제 #2
0
    def test_create_multiple_unclassified_figures(self, mock_figure_class):
        """Test that n calls to GlobalFigureManager create n unclassified _figures numbered 1 to n """
        n = 10  # number of unclassfied _figures to be created
        mock_figures = [mock.Mock() for i in range(n)]
        mock_figure_class.side_effect = mock_figures

        for i in range(n):
            GlobalFigureManager.get_figure_number() # Create a new figure
        for i in range(1, n+1):
            self.assertTrue(i in GlobalFigureManager.all_figure_numbers()) #Check that a new figure with number=i was created
            self.assertRaises(KeyError, GlobalFigureManager.get_category, i) #Check that figure has no category
예제 #3
0
    def test_create_single_unclassified_plot_success(self, mock_figure_class):
        mock_figures = [mock.Mock()]
        mock_figure_class.side_effect = mock_figures

        GlobalFigureManager.get_figure_number()
        self.assertTrue(1 in GlobalFigureManager.all_figure_numbers()
                        )  #Check that a new figure with number=1 was created
        self.assertRaises(KeyError, GlobalFigureManager.get_category,
                          1)  #Check that figure has no category
        self.assertTrue(
            GlobalFigureManager.get_active_figure() ==
            mock_figures[0])  # Check that it is set as the active figure
예제 #4
0
    def test_create_multiple_unclassified_figures(self, mock_figure_class):
        """Test that n calls to GlobalFigureManager create n unclassified _figures numbered 1 to n """
        n = 10  # number of unclassfied _figures to be created
        mock_figures = [mock.Mock() for i in range(n)]
        mock_figure_class.side_effect = mock_figures

        for i in range(n):
            GlobalFigureManager.get_figure_number()  # Create a new figure
        for i in range(1, n + 1):
            self.assertTrue(i in GlobalFigureManager.all_figure_numbers(
            ))  #Check that a new figure with number=i was created
            self.assertRaises(KeyError, GlobalFigureManager.get_category,
                              i)  #Check that figure has no category