예제 #1
0
 def test_odd_bracket(self):
     self.assertFalse(valid_braces('('))
     self.assertFalse(valid_braces(')'))
     self.assertFalse(valid_braces('{'))
     self.assertFalse(valid_braces('}'))
     self.assertFalse(valid_braces('['))
     self.assertFalse(valid_braces(']'))
예제 #2
0
 def test_wrong(self):
     self.assertFalse(valid_braces('({}[]'))
     self.assertFalse(valid_braces('(){[]'))
     self.assertFalse(valid_braces('({}}'))
     self.assertFalse(valid_braces('({}['))
예제 #3
0
 def test_double_brackets(self):
     self.assertTrue(valid_braces('()()'))
     self.assertTrue(valid_braces('(){}'))
     self.assertTrue(valid_braces('()[]'))
예제 #4
0
 def test_double_nested_brackets(self):
     self.assertTrue(valid_braces('(())'))
     self.assertTrue(valid_braces('({})'))
예제 #5
0
 def test_single_brackets(self):
     self.assertTrue(valid_braces('{}'))
     self.assertTrue(valid_braces('[]'))
     self.assertTrue(valid_braces('()'))
 def test_2(self):
     result = valid_braces("([{}])")
     self.assertEqual(result, True)
 def test_1(self):
     result = valid_braces("(){}[]")
     self.assertEqual(result, True)
예제 #8
0
def test_valid_braces(s, result):
    """Test valid braces returns correct result."""
    from valid_braces import valid_braces
    assert valid_braces(s) == result
예제 #9
0
def test_valid_braces_parantheses(s, result):
    """Test valid braces for just parantheses."""
    from valid_braces import valid_braces
    assert valid_braces(s) == result