From 0c2b10b0310834fe1ff92b776669d2a291468845 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 6 Jan 2021 17:21:17 +0100 Subject: [PATCH] Use ternary conditions to gain coverage --- squirrelbattle/interfaces.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/squirrelbattle/interfaces.py b/squirrelbattle/interfaces.py index 472ee95..8fde7a9 100644 --- a/squirrelbattle/interfaces.py +++ b/squirrelbattle/interfaces.py @@ -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: """