diff options
Diffstat (limited to 'test/test_tgplugin.py')
-rw-r--r-- | test/test_tgplugin.py | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/test/test_tgplugin.py b/test/test_tgplugin.py index 3f548c4..df95d00 100644 --- a/test/test_tgplugin.py +++ b/test/test_tgplugin.py @@ -1,49 +1,52 @@ +from mako import compat from mako.ext.turbogears import TGPlugin +from test import template_base +from test import TemplateTest from test.util import result_lines -from test import TemplateTest, template_base -from mako import compat -tl = TGPlugin(options=dict(directories=[template_base]), extension='html') +tl = TGPlugin(options=dict(directories=[template_base]), extension="html") + class TestTGPlugin(TemplateTest): def test_basic(self): - t = tl.load_template('/index.html') - assert result_lines(t.render()) == [ - "this is index" - ] + t = tl.load_template("/index.html") + assert result_lines(t.render()) == ["this is index"] + def test_subdir(self): - t = tl.load_template('/subdir/index.html') + t = tl.load_template("/subdir/index.html") assert result_lines(t.render()) == [ "this is sub index", - "this is include 2" - + "this is include 2", ] - assert tl.load_template('/subdir/index.html').module_id == '_subdir_index_html' + assert ( + tl.load_template("/subdir/index.html").module_id + == "_subdir_index_html" + ) def test_basic_dot(self): - t = tl.load_template('index') - assert result_lines(t.render()) == [ - "this is index" - ] + t = tl.load_template("index") + assert result_lines(t.render()) == ["this is index"] + def test_subdir_dot(self): - t = tl.load_template('subdir.index') + t = tl.load_template("subdir.index") assert result_lines(t.render()) == [ "this is sub index", - "this is include 2" - + "this is include 2", ] - assert tl.load_template('subdir.index').module_id == '_subdir_index_html' + assert ( + tl.load_template("subdir.index").module_id == "_subdir_index_html" + ) def test_string(self): - t = tl.load_template('foo', "hello world") + t = tl.load_template("foo", "hello world") assert t.render() == "hello world" def test_render(self): - assert result_lines(tl.render({}, template='/index.html')) == [ - "this is index" - ] - assert result_lines(tl.render({}, template=compat.u('/index.html'))) == [ + assert result_lines(tl.render({}, template="/index.html")) == [ "this is index" ] + assert result_lines( + tl.render({}, template=compat.u("/index.html")) + ) == ["this is index"] |