Add tests for: message, chat, user, game, animation, document, photo

This commit is contained in:
Alex Root Junior 2017-12-01 01:54:42 +02:00
parent 917c808b3d
commit 02596057a0
10 changed files with 309 additions and 24 deletions

29
tests/test_game.py Normal file
View file

@ -0,0 +1,29 @@
from aiogram import types
from .dataset import GAME
game = types.Game(**GAME)
def test_export():
exported = game.to_python()
assert isinstance(exported, dict)
assert exported == GAME
def test_title():
assert isinstance(game.title, str)
assert game.title == GAME['title']
def test_description():
assert isinstance(game.description, str)
assert game.description == GAME['description']
def test_photo():
assert isinstance(game.photo, list)
assert len(game.photo) == len(GAME['photo'])
assert all(map(lambda t: isinstance(t, types.PhotoSize), game.photo))
def test_animation():
assert isinstance(game.animation, types.Animation)