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