From b3d8ebb2f44839c8143015b37721b456768fed89 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 19 Oct 2022 21:28:50 +0100 Subject: [PATCH] Simplify the tests for a focused game cell --- examples/five_by_five.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/five_by_five.py b/examples/five_by_five.py index 4a0333b36..7b3b50203 100644 --- a/examples/five_by_five.py +++ b/examples/five_by_five.py @@ -230,7 +230,7 @@ class Game(Screen): def action_navigate(self, row: int, col: int) -> None: """Navigate to a new cell by the given offsets.""" - if self.focused and isinstance(self.focused, GameCell): + if isinstance(self.focused, GameCell): self.set_focus( self.cell( (self.focused.row + row) % self.SIZE, @@ -240,7 +240,7 @@ class Game(Screen): def action_move(self) -> None: """Make a move on the current cell.""" - if self.focused and isinstance(self.focused, GameCell): + if isinstance(self.focused, GameCell): self.focused.press() def on_mount(self) -> None: