Exemple #1
0
 def test_unclosed(self):
     self.assertEqual(remove_bracketed_text('a]b[c'), 'ab')
     self.assertEqual(remove_bracketed_text('a(b[c]d{e}f'), 'a')
     self.assertEqual(remove_bracketed_text('a{b}c{d[e]f(g)h'), 'ac')
Exemple #2
0
 def test_extra_closed(self):
     self.assertEqual(remove_bracketed_text('a]b}c)d'), 'abcd')
     self.assertEqual(remove_bracketed_text('a[b]c]d(e)f{g)h}i}j)k]l'),
                      'acdfijkl')
Exemple #3
0
 def test_nested(self):
     self.assertEqual(
         remove_bracketed_text('a[[b]c(d)e{f}]g(h(i)j[k]l{m})n{{{o}}}p'),
         'agnp')
Exemple #4
0
 def test_mismatched(self):
     self.assertEqual(remove_bracketed_text('a[b(c]d)e'), 'ae')
     self.assertEqual(remove_bracketed_text('a{b(c}d)e'), 'ae')
Exemple #5
0
 def test_brackets(self):
     self.assertEqual(remove_bracketed_text('a[b]c(d)e{f}g<h>i'),
                      'aceg<h>i')