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(']'))
def test_wrong(self): self.assertFalse(valid_braces('({}[]')) self.assertFalse(valid_braces('(){[]')) self.assertFalse(valid_braces('({}}')) self.assertFalse(valid_braces('({}['))
def test_double_brackets(self): self.assertTrue(valid_braces('()()')) self.assertTrue(valid_braces('(){}')) self.assertTrue(valid_braces('()[]'))
def test_double_nested_brackets(self): self.assertTrue(valid_braces('(())')) self.assertTrue(valid_braces('({})'))
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)
def test_valid_braces(s, result): """Test valid braces returns correct result.""" from valid_braces import valid_braces assert valid_braces(s) == result
def test_valid_braces_parantheses(s, result): """Test valid braces for just parantheses.""" from valid_braces import valid_braces assert valid_braces(s) == result