Example #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')
Example #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')
Example #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')
Example #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')
Example #5
0
 def test_brackets(self):
     self.assertEqual(remove_bracketed_text('a[b]c(d)e{f}g<h>i'),
                      'aceg<h>i')