Esempio n. 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(']'))
Esempio n. 2
0
 def test_wrong(self):
     self.assertFalse(valid_braces('({}[]'))
     self.assertFalse(valid_braces('(){[]'))
     self.assertFalse(valid_braces('({}}'))
     self.assertFalse(valid_braces('({}['))
Esempio n. 3
0
 def test_double_brackets(self):
     self.assertTrue(valid_braces('()()'))
     self.assertTrue(valid_braces('(){}'))
     self.assertTrue(valid_braces('()[]'))
Esempio n. 4
0
 def test_double_nested_brackets(self):
     self.assertTrue(valid_braces('(())'))
     self.assertTrue(valid_braces('({})'))
Esempio n. 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)
Esempio n. 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
Esempio n. 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