def test_input_dict__lookup_template_filename__with_namespace(self): from korpokkur.emitter.mako import ( MakoEmitter, InputEnv ) input = self._makeDictInput({"name": "foo"}) filename = os.path.join(self.HERE, "hello_with_helpers.mako") target = MakoEmitter(InputEnv) result = target.emit(input, filename=filename) self.assertEqual(result.strip(), "foo,foo")
def test_input_commandline(self): from korpokkur.emitter.mako import ( MakoEmitter, InputEnv ) input = self._makeCommandLineInput(input_string="foo\n") template = "myname is ${name}" target = MakoEmitter(InputEnv) result = target.emit(input, text=template) self.assertEqual(result, "myname is foo")
def test_it(self): from korpokkur.emitter.mako import ( MakoEmitter, InputEnv ) input = self._makeDictInput({"name": "foo"}) template = "myname is ${name}" target = MakoEmitter(InputEnv) result = target.emit(input, text=template) self.assertEqual(result, "myname is foo")
def test_input_commandline__with_deftemplate(self): from korpokkur.emitter.mako import ( MakoEmitter, InputEnv ) input = self._makeCommandLineInput(input_string="foo\n") template = """\ <%def name="greeting(name)"> myname is ${name} </%def> ${greeting(name)} ${greeting(name)} """ target = MakoEmitter(InputEnv) result = target.emit(input, text=template).replace("\n", "") self.assertEqual(result, "myname is foomyname is foo")