Skip to content

Commit

Permalink
Fixed tests, according to strange qodana recommendations x2
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tveevm committed Oct 7, 2024
1 parent 6959231 commit 08b86c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Shunting Yard/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "*"]),
Expand Down
12 changes: 8 additions & 4 deletions algo/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)


Expand Down

0 comments on commit 08b86c1

Please sign in to comment.