def test_single_pair(self):
     '''Tests if the function returns 0 with a single pair'''
     self.assertTrue(is_closed('()') == 0)
 def test_single_open(self):
     '''Tests if the function returns 1 with 1 open parenthese'''
     self.assertTrue(is_closed('(') == 1)
 def test_single_closed(self):
     '''Tests if the function returns -1 with 1 closed parenthese'''
     self.assertTrue(is_closed(')') == -1)
 def test_wrong_order(self):
     '''Does the function return -1 when  there are the right number of parens in an invalid order?'''
     self.assertTrue(is_closed(')(') == -1)
 def test_empty(self):
     '''Tests if the function returns 0 on an empty string'''
     self.assertTrue(is_closed('') == 0)
예제 #6
0
 def test_broken(self):
     '''Does the function return -1 when there are too many closing parentheses?'''
     self.assertTrue(is_closed('(()))') == -1)
 def test_broken(self):
     '''Does the function return -1 when there are too many closing parentheses?'''
     self.assertTrue(is_closed('(()))') == -1)
예제 #8
0
 def test_none(self):
     '''Tests if the function raises an exception if the input is None'''
     with self.assertRaises(TypeError):
         is_closed(None)
예제 #9
0
 def test_balanced(self):
     """Does the function return 0 on a properly matched set of parentheses?"""
     self.assertTrue(is_closed('(())') == 0)
예제 #10
0
 def test_single_closed(self):
     '''Tests if the function returns -1 with 1 closed parenthese'''
     self.assertTrue(is_closed(')') == -1)
예제 #11
0
 def test_single_pair(self):
     '''Tests if the function returns 0 with a single pair'''
     self.assertTrue(is_closed('()') == 0)
예제 #12
0
 def test_single_open(self):
     '''Tests if the function returns 1 with 1 open parenthese'''
     self.assertTrue(is_closed('(') == 1)
예제 #13
0
 def test_empty(self):
     '''Tests if the function returns 0 on an empty string'''
     self.assertTrue(is_closed('') == 0)
예제 #14
0
 def test_wrong_order(self):
     '''Does the function return -1 when  there are the right number of parens in an invalid order?'''
     self.assertTrue(is_closed(')(') == -1)
예제 #15
0
 def test_none(self):
     '''Tests if the function raises an exception if the input is None'''
     with self.assertRaises(TypeError):
         is_closed(None)
예제 #16
0
 def test_open(self):
     '''Does the function return 1 when there are too many opening parentheses?'''
     self.assertTrue(is_closed('((())') == 1)
예제 #17
0
 def test_balanced(self):
     """Does the function return 0 on a properly matched set of parentheses?"""
     self.assertTrue(is_closed('(())') == 0)
예제 #18
0
 def test_open(self):
     '''Does the function return 1 when there are too many opening parentheses?'''
     self.assertTrue(is_closed('((())') == 1)