From 486df800d80deff409278540abfc2176c24969cc Mon Sep 17 00:00:00 2001 From: Michael Knudsen Date: Fri, 1 Dec 2023 07:56:46 +0100 Subject: [PATCH] Less extreme code formatting --- 2015/01/code.py | 99 ++++++++----------------------------------------- 1 file changed, 15 insertions(+), 84 deletions(-) diff --git a/2015/01/code.py b/2015/01/code.py index fe6103b..ea8e26c 100644 --- a/2015/01/code.py +++ b/2015/01/code.py @@ -62,89 +62,27 @@ def deliver_presents( class TestCode(unittest.TestCase): def test_deliver_presents(self) -> None: - self.assertEqual( - deliver_presents( - instructions="(())", - ), - 0, - ) - self.assertEqual( - deliver_presents( - instructions="()()", - ), - 0, - ) - self.assertEqual( - deliver_presents( - instructions="(((", - ), - 3, - ) - self.assertEqual( - deliver_presents( - instructions="(()(()(", - ), - 3, - ) - self.assertEqual( - deliver_presents( - instructions="))(((((", - ), - 3, - ) - self.assertEqual( - deliver_presents( - instructions="())", - ), - -1, - ) - self.assertEqual( - deliver_presents( - instructions="))(", - ), - -1, - ) - self.assertEqual( - deliver_presents( - instructions=")))", - ), - -3, - ) - self.assertEqual( - deliver_presents( - instructions=")())())", - ), - -3, - ) + self.assertEqual(deliver_presents(instructions="(())"), 0) + self.assertEqual(deliver_presents(instructions="()()"), 0) + self.assertEqual(deliver_presents(instructions="((("), 3) + self.assertEqual(deliver_presents(instructions="(()(()("), 3) + self.assertEqual(deliver_presents(instructions="))((((("), 3) + self.assertEqual(deliver_presents(instructions="())"), -1) + self.assertEqual(deliver_presents(instructions="))("), -1) + self.assertEqual(deliver_presents(instructions=")))"), -3) + self.assertEqual(deliver_presents(instructions=")())())"), -3) def test_deliver_presents_with_stop(self) -> None: - self.assertEqual( - deliver_presents( - instructions=")", - stop=-1, - ), - 1, - ) - self.assertEqual( - deliver_presents( - instructions="()())", - stop=-1, - ), - 5, - ) + self.assertEqual(deliver_presents(instructions=")", stop=-1), 1) + self.assertEqual(deliver_presents(instructions="()())", stop=-1), 5) def test_deliver_presents_invalid_instruction(self) -> None: with self.assertRaises(InvalidInstructionError): - deliver_presents( - instructions=")[(", - ) + deliver_presents(instructions=")[(") def test_deliver_presents_with_stop_floor_never_reached(self) -> None: with self.assertRaises(FloorNeverReachedError): - deliver_presents( - instructions="(", - stop=-1, - ) + deliver_presents(instructions="(", stop=-1) class TestPuzzle(unittest.TestCase): @@ -153,16 +91,9 @@ def setUp(self) -> None: self.instructions = f.read() def test_part_one(self) -> None: - self.assertEqual( - deliver_presents(instructions=self.instructions), - 232, - ) + self.assertEqual(deliver_presents(instructions=self.instructions), 232) def test_part_two(self) -> None: self.assertEqual( - deliver_presents( - instructions=self.instructions, - stop=-1, - ), - 1783, + deliver_presents(instructions=self.instructions, stop=-1), 1783 )