示例#1
0
		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)
示例#2
0
		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)
示例#3
0
		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)
示例#4
0
		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, "]]")
示例#5
0
		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, "}}")
示例#6
0
		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)
示例#7
0
		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)