def test_text_between_not_found(self): expected = self.s result = Utils.text_between(self.s, '<h1>', '</h1>') result_force_html = Utils.text_between(self.s, '<h1', '/h1', True) self.assertEqual(expected, result) self.assertEqual(expected, result_force_html)
def test_remove_spaces(self): text = 'Something else\nand another thing ' expected = 'Something else and another thing' result = Utils.remove_spaces(text) self.assertEqual(expected, result)
def test_text_after_not_found(self): expected = self.s result = Utils.text_after(self.s, '<h1>') self.assertEqual(expected, result)
def test_text_between(self): expected = 'Something' result = Utils.text_between(self.s, '<a href="#">', '</a>') result_force_html = Utils.text_between(self.s, '<a', '/a', True) self.assertEqual(expected, result) self.assertEqual(expected, result_force_html)
def test_text_before_not_found(self): expected = self.s result = Utils.text_before(self.s, '</br>') self.assertEqual(expected, result)
def test_text_after(self): expected = 'Something</a>' result = Utils.text_after(self.s, '<a href="#">') self.assertEqual(expected, result)
def test_remove_tags(self): expected = 'Something' result = Utils.remove_tags(self.s) self.assertEqual(expected, result)
def test_text_before(self): expected = '<a href="#">Something' result = Utils.text_before(self.s, '</a>') self.assertEqual(expected, result)
def test_remove_accents(self): text = 'trava-língua' expected = 'trava-lingua' result = Utils.remove_accents(text) self.assertEqual(expected, result)
def test_split_html_tag(self): html = 'Something<br>else<br />and<br/>another<br></br>thing' expected = ['Something', 'else', 'and', 'another', 'thing'] result = Utils.split_html_tag(html, 'br') self.assertListEqual(expected, result)