From 6341f39fb000675190f8697197a791eed6755668 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Tue, 5 Jan 2021 10:20:55 +0100 Subject: [PATCH] Linting --- squirrelbattle/tests/entities_test.py | 17 ++++++++--------- squirrelbattle/tests/game_test.py | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/squirrelbattle/tests/entities_test.py b/squirrelbattle/tests/entities_test.py index 7d4981f..b2272f2 100644 --- a/squirrelbattle/tests/entities_test.py +++ b/squirrelbattle/tests/entities_test.py @@ -95,12 +95,11 @@ class TestEntities(unittest.TestCase): entity = Rabbit() self.map.add_entity(entity) self.map.add_entity(fam) - self.player.move(1, 6) entity.move(2, 6) fam.move(2, 7) - #test fighting + # Test fighting entity.health = 2 entity.paths = [] entity.recalculate_paths() @@ -108,29 +107,29 @@ class TestEntities(unittest.TestCase): self.map.tick(self.player) self.assertTrue(entity.dead) - #test finding a new target + # Test finding a new target entity2 = Rabbit() self.map.add_entity(entity2) entity2.move(2, 6) self.map.tick(self.player) - self.assertTrue(fam.target==entity2) + self.assertTrue(fam.target == entity2) self.map.remove_entity(entity2) - #test following the player and finding the player as target + # Test following the player and finding the player as target self.player.move(5, 5) fam.move(4, 5) fam.target = None self.player.move_down() self.map.tick(self.player) - self.assertTrue(fam.target==self.player) + self.assertTrue(fam.target == self.player) self.assertEqual(fam.y, 5) self.assertEqual(fam.x, 5) - #test random move + # Test random move fam.move(13, 20) - fam.target=self.player + fam.target = self.player self.map.tick(self.player) - self.assertTrue(fam.x!=20 or fam.y!=13) + self.assertTrue(fam.x != 20 or fam.y != 13) def test_items(self) -> None: """ diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index 3ee00b7..54e18d6 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -41,9 +41,9 @@ class TestGame(unittest.TestCase): bomb.hold(self.game.player) sword.hold(self.game.player) - for entity in self.game.map.entities : - #trumpets change order when they are loaded, so it is unsuitable for simple testing - if entity.name == 'trumpet' : + for entity in self.game.map.entities: + # trumpets change order when they are loaded, this breaks the test. + if entity.name == 'trumpet': self.game.map.remove_entity(entity) # Ensure that merchants can be saved