def test_ink_renderer_render_new_delim(self): """Test Ink render with new delimiters""" template_string = FileReader(self.template_path2).read_utf8() standard_string = FileReader(self.standard_path).read_utf8() template = Template(template_string, "[[", "]]", escape_regex=True) # have to escape special regex chars renderer = Renderer(template, self.key_dictionary) rendered_doc = renderer.render() self.assertEqual(rendered_doc, standard_string)
def test_ink_renderer_render_fail_with_incorrect_delim(self): """Confirm that Ink renderer fails with incorrect delimiter assignment""" template_string = FileReader(self.template_path).read_utf8() standard_string = FileReader(self.standard_path).read_utf8() template = Template(template_string, "[[", "]]") renderer = Renderer(template, self.key_dictionary) rendered_doc = renderer.render() self.assertNotEqual(rendered_doc, standard_string)
def test_ink_renderer_render_default_delim(self): """Test Ink render with default delimiters""" template_string = FileReader(self.template_path).read_utf8() standard_string = FileReader(self.standard_path).read_utf8() template = Template(template_string) renderer = Renderer(template, self.key_dictionary) rendered_doc = renderer.render() self.assertEqual(rendered_doc, standard_string)
def test_ink_renderer_new_delimiters(self): """Test new Ink renderer assignment of new delimiters from the template""" template_string = FileReader(self.template_path2).read_utf8() template = Template(template_string, "[[", "]]") renderer = Renderer(template, self.key_dictionary) self.assertEqual(renderer.odel, "[[") self.assertEqual(renderer.cdel, "]]")
def test_ink_renderer_default_delimiters(self): """Test new Ink renderer assignment of default delimiters from the template""" template_string = FileReader(self.template_path).read_utf8() template = Template(template_string) renderer = Renderer(template, self.key_dictionary) self.assertEqual(renderer.odel, "{{") self.assertEqual(renderer.cdel, "}}")
def test_ink_renderer_key_dictionary(self): """Test new Ink renderer key_dict property""" template_string = FileReader(self.template_path).read_utf8() template = Template(template_string) renderer = Renderer(template, self.key_dictionary) self.assertEqual(renderer.key_dict, self.key_dictionary)
def test_ink_renderer_template_property_string(self): """Test new Ink renderer template property is a string""" template_string = FileReader(self.template_path).read_utf8() template = Template(template_string) renderer = Renderer(template, self.key_dictionary) self.assertIsInstance(renderer.template, str)