Beispiel #1
0
    def test_get_problems_none_found(self):
        p_g = ProblemGetter(db_gateway=Mock(), presenter=Mock())
        p_g.repo.get_problems.return_value = []

        expected_df = add_missing_columns(
            df=pd.DataFrame(), required_columns=self.problem_columns)

        res = p_g._get_problems()

        assert_frame_equal(expected_df, res)
Beispiel #2
0
    def test_get_problems(self):
        mock_repo = Mock()
        mock_repo.get_problems.return_value = [self.problem]
        p_g = ProblemGetter(db_gateway=mock_repo, presenter=Mock())

        problem_df = p_g._get_problems(name_substr='aa',
                                       tags_any=['bb'],
                                       tags_all=['cc'])

        expected_result = self.problem_df

        mock_repo.get_problems.assert_called_once_with(name_substr='aa',
                                                       tags_any=['bb'],
                                                       tags_all=['cc'])

        assert_frame_equal(expected_result, problem_df,
                           check_like=True)  # no particular column order