Mysteriously fix tests

This commit is contained in:
Yohann D'ANELLO
2020-11-10 20:43:30 +01:00
parent f9c3fc1517
commit d50c775e0f
3 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,7 @@
import curses
from typing import Any, Union
from typing import Any, Optional, Union
from dungeonbattle.display.texturepack import TexturePack
from dungeonbattle.tests.screen import FakePad
@ -10,9 +11,9 @@ class Display:
width: int
height: int
def __init__(self, screen: Any, pack: Any):
def __init__(self, screen: Any, pack: Optional[TexturePack] = None):
self.screen = screen
self.pack = pack
self.pack = pack or TexturePack.get_pack("ascii")
def newpad(self, height: int, width: int) -> Union[FakePad, Any]:
return curses.newpad(height, width) if self.screen else FakePad()

View File

@ -6,8 +6,8 @@ from dungeonbattle.entities.player import Player
class StatsDisplay(Display):
player: Player
def __init__(self, *args):
super().__init__(*args)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pad = self.newpad(self.rows, self.cols)
def update_player(self, p: Player) -> None: