From 38f23b340cdb75d292d5d9ba62bdc5df5ea32dab Mon Sep 17 00:00:00 2001 From: Chris Davoren Date: Wed, 15 Nov 2023 12:39:04 +1000 Subject: [PATCH] style: black formatting on additional file --- trtests.py | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/trtests.py b/trtests.py index 53ed6a2..1a117dc 100644 --- a/trtests.py +++ b/trtests.py @@ -3,8 +3,8 @@ import unittest import toyrobot -class ToyRobotTests(unittest.TestCase): +class ToyRobotTests(unittest.TestCase): def test_creation(self): robot = toyrobot.Robot() self.assertFalse(robot.is_initialized()) @@ -17,25 +17,27 @@ class ToyRobotTests(unittest.TestCase): def test_invalid_max_x(self): exception_thrown = False try: - robot = toyrobot.Robot(-1, 5) - except ValueError as ve: + toyrobot.Robot(-1, 5) + except ValueError: exception_thrown = True self.assertTrue(exception_thrown) def test_invalid_max_y(self): exception_thrown = False try: - robot = toyrobot.Robot(5, -1) - except ValueError as ve: + toyrobot.Robot(5, -1) + except ValueError: exception_thrown = True self.assertTrue(exception_thrown) def test_valid_place(self): robot = toyrobot.Robot() robot.place(1, 1, "NORTH") - self.assertTrue(robot.is_initialized() and \ - robot.get_position() == (1, 1) and \ - robot.get_direction() == "NORTH") + self.assertTrue( + robot.is_initialized() + and robot.get_position() == (1, 1) + and robot.get_direction() == "NORTH" + ) def test_invalid_place_position_x(self): robot = toyrobot.Robot() @@ -66,17 +68,21 @@ class ToyRobotTests(unittest.TestCase): robot = toyrobot.Robot() robot.place(5, 5, "NORTH") robot.place(2, 2) - self.assertTrue(robot.is_initialized() and \ - robot.get_position() == (2, 2) and \ - robot.get_direction() == "NORTH") + self.assertTrue( + robot.is_initialized() + and robot.get_position() == (2, 2) + and robot.get_direction() == "NORTH" + ) def test_double_place_2(self): robot = toyrobot.Robot() robot.place(5, 5, "NORTH") robot.place(2, 2, "SOUTH") - self.assertTrue(robot.is_initialized() and \ - robot.get_position() == (2, 2) and \ - robot.get_direction() == "SOUTH") + self.assertTrue( + robot.is_initialized() + and robot.get_position() == (2, 2) + and robot.get_direction() == "SOUTH" + ) def test_valid_movement_x(self): robot = toyrobot.Robot() @@ -150,9 +156,11 @@ class ToyRobotTests(unittest.TestCase): robot.move() robot.place(3, 1) robot.move() - self.assertTrue(robot.is_initialized() and \ - robot.get_position() == (3, 2) and \ - robot.get_direction() == "NORTH") + self.assertTrue( + robot.is_initialized() + and robot.get_position() == (3, 2) + and robot.get_direction() == "NORTH" + ) def test_example_d_commands(self): robot = toyrobot.Robot() @@ -164,5 +172,6 @@ class ToyRobotTests(unittest.TestCase): robot.interpret_command("MOVE") self.assertTrue(str(robot) == "3,2,NORTH") -if __name__ == '__main__': + +if __name__ == "__main__": unittest.main()