Use ternary conditions to gain coverage

This commit is contained in:
Yohann D'ANELLO 2021-01-06 17:21:17 +01:00
parent 887a190f11
commit 0c2b10b031
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 6 deletions

View File

@ -217,18 +217,15 @@ class Tile(Enum):
to the texture pack
"""
val = getattr(pack, self.name)
if isinstance(val, tuple):
return val[0]
return val
return val[0] if isinstance(val, tuple) else val
def color(self, pack: TexturePack) -> Tuple[int, int]:
"""
Retrieve the tuple (fg_color, bg_color) of the current Tile.
"""
val = getattr(pack, self.name)
if isinstance(val, tuple):
return val[1], val[2]
return pack.tile_fg_color, pack.tile_bg_color
return (val[1], val[2]) if isinstance(val, tuple) else \
(pack.tile_fg_color, pack.tile_bg_color)
def is_wall(self) -> bool:
"""