Exemple #1
0
    def test_de_json(self, bot):
        json_dict = {"position": self.position, "user": self.user.to_dict(), "score": self.score}
        highscore = GameHighScore.de_json(json_dict, bot)

        assert highscore.position == self.position
        assert highscore.user == self.user
        assert highscore.score == self.score

        assert GameHighScore.de_json(None, bot) is None
Exemple #2
0
    def test_equality(self):
        a = GameHighScore(1, User(2, "test user", False), 42)
        b = GameHighScore(1, User(2, "test user", False), 42)
        c = GameHighScore(2, User(2, "test user", False), 42)
        d = GameHighScore(1, User(3, "test user", False), 42)
        e = User(3, "test user", False)

        assert a == b
        assert hash(a) == hash(b)

        assert a != c
        assert hash(a) != hash(c)

        assert a != d
        assert hash(a) != hash(d)

        assert a != e
        assert hash(a) != hash(e)
Exemple #3
0
    def test_de_json(self, bot):
        json_dict = {'position': self.position,
                     'user': self.user.to_dict(),
                     'score': self.score}
        highscore = GameHighScore.de_json(json_dict, bot)

        assert highscore.position == self.position
        assert highscore.user == self.user
        assert highscore.score == self.score
    def test_de_json(self, bot):
        json_dict = {'position': self.position,
                     'user': self.user.to_dict(),
                     'score': self.score}
        highscore = GameHighScore.de_json(json_dict, bot)

        assert highscore.position == self.position
        assert highscore.user == self.user
        assert highscore.score == self.score
Exemple #5
0
def game_highscore():
    return GameHighScore(
        TestGameHighScore.position, TestGameHighScore.user, TestGameHighScore.score
    )