示例#1
0
 def test_complex_latex_expression(self):
     self.assertEqual(
         is_paired(
             "\left(\begin{array}{cc} \frac{1}{3} & x\\ \mathrm{e}^{x} &... x^2 \end{array}\right)"
         ),
         True,
     )
示例#2
0
 def test_paired_and_incomplete_brackets(self):
     self.assertEqual(is_paired("{}["), False)
示例#3
0
 def test_paired_and_wrong_nested_brackets(self):
     self.assertEqual(is_paired("[({]})"), False)
示例#4
0
 def test_unpaired_and_nested_brackets(self):
     self.assertEqual(is_paired("([{])"), False)
示例#5
0
 def test_unopened_closing_brackets(self):
     self.assertEqual(is_paired("{[)][]}"), False)
示例#6
0
 def test_paired_and_nested_brackets(self):
     self.assertEqual(is_paired("([{}({}[])])"), True)
 def test_early_mismatched_brackets(self):
     self.assertEqual(is_paired("{)()"), False)
示例#8
0
 def test_partially_paired_brackets(self):
     self.assertEqual(is_paired("{[])"), False)
示例#9
0
 def test_wrong_closing_bracket(self):
     self.assertEqual(is_paired("{]"), False)
示例#10
0
 def test_paired_with_whitespace(self):
     self.assertEqual(is_paired("{ }"), True)
示例#11
0
 def test_wrong_ordered_brackets(self):
     self.assertEqual(is_paired("}{"), False)
示例#12
0
 def test_unpaired_brackets(self):
     self.assertEqual(is_paired("[["), False)
示例#13
0
 def test_empty_string(self):
     self.assertEqual(is_paired(""), True)
示例#14
0
 def test_too_many_closing_brackets(self):
     self.assertEqual(is_paired("[]]"), False)
示例#15
0
 def test_simple_nested_brackets(self):
     self.assertEqual(is_paired("{[]}"), True)
示例#16
0
 def test_math_expression(self):
     self.assertEqual(is_paired("(((185 + 223.85) * 15) - 543)/2"), True)
示例#17
0
 def test_several_paired_brackets(self):
     self.assertEqual(is_paired("{}[]"), True)
示例#18
0
 def test_paired_square_brackets(self):
     self.assertEqual(is_paired("[]"), True)
 def test_early_unexpected_brackets(self):
     self.assertEqual(is_paired(")()"), False)