def test_closed_prs(self): """ Test the closed pull requests metric. """ closed = github_prs.ClosedPRs(self.github_index, self.start, self.end) last, trend_percentage = get_trend(closed.timeseries()) self.assertEquals(last, CLOSED_TREND_LAST) self.assertEquals(trend_percentage, CLOSED_TREND_PRECENTAGE)
def test_closed_prs_timeseries_with_df(self): """ Test if the timeseries dataframe for closed prs metrics are returned correctly or not. """ closed_prs = github_prs.ClosedPRs(self.github_index, self.start, self.end) closed_prs_ts = closed_prs.timeseries(dataframe=True) closed_prs_test = pd.read_csv(CLOSED_PRS_BY_MONTH) self.assertIsInstance(closed_prs_ts, pd.DataFrame) assert_array_equal(closed_prs_test['value'], closed_prs_ts['value'])
def test_closed_prs_timeseries_non_df(self): """ Test if the timeseries for closed prs metrics are returned correctly or not. """ closed_prs = github_prs.ClosedPRs(self.github_index, self.start, self.end) closed_prs_ts = closed_prs.timeseries() closed_prs_test = pd.read_csv(CLOSED_PRS_BY_MONTH) closed_prs_test['date'] = [ parser.parse(item).date() for item in closed_prs_test['date'] ] assert_array_equal(closed_prs_test['date'], closed_prs_ts['date']) assert_array_equal(closed_prs_test['value'], closed_prs_ts['value'])