Use ternary conditions to gain coverage
This commit is contained in:
parent
887a190f11
commit
0c2b10b031
@ -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:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user