def test_process_next_line(self): c = Compiler() c.text = "div\ndiv" c.process_next_line() self.assertEqual(c.inner_text, None) c = Compiler() c.text = "div <asdf>\ndiv" c.process_next_line() self.assertEqual(c.inner_text, "asdf") c = Compiler() c.text = "div <<%= val %> asdf>\ndiv" c.process_next_line() self.assertEqual(c.inner_text, "<%= val %> asdf") c = Compiler() c.text = "div href=# <asdf \n asdf ;lkj <%= val %>>\ndiv" c.process_next_line() self.assertEqual(c.inner_text, "asdf asdf ;lkj <%= val %>") c = Compiler() c.indent_token = " " c.text = "div \-\ a href=# <asdf>" c.process_next_line() self.assertEqual(c.output, '<div>\n <a href="#">asdf</a>\n') c = Compiler() c.indent_token = " " c.text = "div \-\ a href=# target=_blank \-\ span <asdf>" c.process_next_line() self.assertEqual(c.output, '<div>\n <a href="#" target="_blank">\n <span>asdf</span>\n')
def test_process_current_level(self): c = Compiler() c.text = " div" c.process_current_level() self.assertEqual(c.previous_level, 0) self.assertEqual(c.current_level, 1) self.assertEqual(c.indent_token, " ") c = Compiler() c.text = " div" c.indent_token = " " c.process_current_level() self.assertEqual(c.previous_level, 0) self.assertEqual(c.current_level, 2) self.assertEqual(c.indent_token, " ") c = Compiler() c.text = "\t\tdiv" c.indent_token = "\t" c.process_current_level() self.assertEqual(c.previous_level, 0) self.assertEqual(c.current_level, 2) self.assertEqual(c.indent_token, "\t")