Ejemplo n.º 1
0
    def test_leaderboard_fail_on_wrong_type(self, caplog):
        with pytest.raises(TypeError):
            _ = Convert.leaderboard("not a LeaderBoardResponse")

        for record in caplog.records:
            assert record.levelname == "ERROR"
            assert "Tried to use method with a parameter of type != 'LeaderBoardResponse'" in caplog.text
Ejemplo n.º 2
0
    def test_leaderboard(self, leaderboard_defaults_payload,
                         leaderboard_converted):
        responses.add(
            responses.GET,
            "https://aoe2.net/api/leaderboard",
            json=leaderboard_defaults_payload,
            status=200,
        )

        result = self.client.leaderboard()
        dframe = Convert.leaderboard(result)

        assert isinstance(dframe, pd.DataFrame)
        assert dframe.size == 230
        assert dframe.shape == (10, 23)
        pd.testing.assert_frame_equal(dframe, leaderboard_converted)