diff --git a/Shunting Yard/tests.py b/Shunting Yard/tests.py index e8bfa85..168e37b 100644 --- a/Shunting Yard/tests.py +++ b/Shunting Yard/tests.py @@ -4,11 +4,12 @@ class MyTestCase(unittest.TestCase): - def __init__(self): - super().__init__() + + def setup(self): self.sol = Solution() def test_algo(self): + self.setup() test_cases = [ ("3 + 4 * 5", ["3", "4", "5", "*", "+"]), ("( 3 + 4 ) * 5", ["3", "4", "+", "5", "*"]), diff --git a/algo/tests.py b/algo/tests.py index 780742c..4a26f21 100644 --- a/algo/tests.py +++ b/algo/tests.py @@ -5,11 +5,11 @@ class TestQueue(unittest.TestCase): - def __init__(self): - super().__init__() + def setup(self): self.__queue = Queue() def test_push_and_pop(self): + setup() self.__queue.push(1) self.__queue.push(2) self.__queue.push(3) @@ -20,18 +20,20 @@ def test_push_and_pop(self): self.assertIsNone(self.__queue.pop()) def test_pop_empty(self): + self.setup() self.assertIsNone(self.__queue.pop()) def test_len_empty(self): + self.setup() self.assertEqual(len(self.__queue), 0) class TestStack(unittest.TestCase): - def __init__(self): - super().__init__() + def setup(self): self.__stack = Stack() def test_push_and_pop(self): + self.setup() self.__stack.push(1) self.__stack.push(2) self.__stack.push(3) @@ -42,9 +44,11 @@ def test_push_and_pop(self): self.assertIsNone(self.__stack.pop()) def test_pop_empty(self): + self.setup() self.assertIsNone(self.__stack.pop()) def test_len_empty(self): + self.setup() self.assertEqual(len(self.__stack), 0)