Exemple #1
0
    def test_plot_stacked_barchart_does_plot(self, mock_writer):
        dummy_dataframe = pd.DataFrame(
            data=[["Label %d" % dummyval, dummyval, dummyval]
                  for dummyval in list(range(0, 10))],
            columns=["Label", "Value 1", "Value 2"],
        )
        sut.plot_stacked_barchart(dummy_dataframe, "", "", "", "")

        self.assertTrue(mock_writer.called)
Exemple #2
0
    def test_plot_stacked_barchart_does_plot_if_data_extends_max_limit(
            self, mock_writer):
        dummy_dataframe = pd.DataFrame(
            data=[[
                "Label with long long long long long long long long long long long long long long text %d"
                % dummyval,
                dummyval,
                dummyval,
            ] for dummyval in list(range(0, 100))],
            columns=["Label", "Value 1", "Value 2"],
        )
        sut.plot_stacked_barchart(dummy_dataframe, "", "", "", "")

        self.assertTrue(mock_writer.called)
Exemple #3
0
 def write_results(self, output_dir):
     writer.write_dataframe_to_xls(
         self._analysis_result,
         "changed_lines_per_file.xls",
         output_dir,
         "Changes since " + self._workspace.since,
     )
     barchart_data = self._create_barchart_data()
     plot.plot_stacked_barchart(
         barchart_data,
         "Number of changed lines",
         "Number of changed lines for most changed files since " +
         self._workspace.since,
         output_dir,
         "most_changed_files.pdf",
     )
    def test_plot_stacked_barchart_plots_expected_barchart_if_dataframe_extends_max_limit(
        self
    ):
        """Make shure barcharts are limit to _MAX_BARCHART_ENTRIES"""
        dummy_dataframe = pd.DataFrame(
            data=[
                ["Label %d" % dummyval, dummyval, dummyval * 0.5]
                for dummyval in list(range(-10, 100))
            ],
            columns=["Labels", "Lines Added", "Lines Removed"],
        )
        sut.plot_stacked_barchart(
            dummy_dataframe,
            "total",
            "dummyTitle",
            reporttest.TEST_RESULTS_FOLDER,
            self._used_file_name,
        )

        reporttest.assert_images_equal(
            self._stacked_barchart_output_path, self._ref_stacked_barchart_path
        )
Exemple #5
0
    def test_plot_stacked_barchart_does_not_plot_if_dataframe_empty(
            self, mock_writer):
        sut.plot_stacked_barchart(pd.DataFrame(), "", "", "", "")

        self.assertFalse(mock_writer.called)