示例#1
0
    def test_authors_list(self):
        """
        Test if the list of top authors is returned correctly or not.
        """

        authors = git.Authors(self.git_index, self.start, self.end)
        authors_list = authors.aggregations()
        authors_test = load_json_file(TOP_AUTHORS)
        assert_array_equal(authors_list['keys'], authors_test['keys'])
        assert_array_equal(authors_list['values'], authors_test['values'])
示例#2
0
    def test_authors_timeseries_with_df(self):
        """
        Test if the timeseries dataframe for author metrics are
        returned correctly or not.
        """

        authors = git.Authors(self.git_index, self.start, self.end)
        authors_ts = authors.timeseries(dataframe=True)
        authors_test = pd.read_csv(AUTHORS_BY_PERIOD)
        self.assertIsInstance(authors_ts, pd.DataFrame)
        assert_array_equal(authors_test['value'], authors_ts['value'])
示例#3
0
    def test_authors_timeseries_non_df(self):
        """
        Test if the timeseries for author metrics are returned
        correctly or not.
        """

        authors = git.Authors(self.git_index, self.start, self.end)
        authors_ts = authors.timeseries()
        authors_test = pd.read_csv(AUTHORS_BY_PERIOD)
        authors_test['date'] = [
            parser.parse(item).date() for item in authors_test['date']
        ]
        assert_array_equal(authors_test['value'], authors_ts['value'])
        assert_array_equal(authors_test['date'], authors_ts['date'])