Ejemplo n.º 1
0
    def test_last_match_fail_on_wrong_type(self, caplog):
        with pytest.raises(TypeError):
            _ = Convert.last_match(json)

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

        result = self.client.last_match(steam_id=76561199003184910)
        dframe = Convert.last_match(result)

        assert isinstance(dframe, pd.DataFrame)
        assert dframe.size == 45
        assert dframe.shape == (1, 45)
        pd.testing.assert_frame_equal(dframe, last_match_converted)