"""Unit Tests for Extended Layouts.""" __revision__ = "$Rev: 455 $" __author__ = "Christoph Zwerschke " __copyright__ = "Copyright 2006, Christoph Zwerschke" from os.path import join as joinpath from tempfile import mkdtemp from shutil import rmtree import kid def setup_module(module): global tmpdir tmpdir = mkdtemp(prefix='kid_test_extended_layout_') kid.path.insert(tmpdir) def teardown_module(module): kid.path.remove(tmpdir) rmtree(tmpdir) def test_extended_layout(): """Test layout template extended by another template.""" open(joinpath(tmpdir, 'master.kid'), 'w').write("""\

Master Title

""") t = kid.Template(file="master.kid") rslt = t.serialize(output='xhtml') assert '' in rslt assert '' in rslt assert 'head' not in rslt assert 'master.js' not in rslt assert 'body' not in rslt assert 'Title' not in rslt open(joinpath(tmpdir, 'section.kid'), 'w').write("""\ Section Title

Section Title

Section content
""") t = kid.Template(file="section.kid") rslt = t.serialize(output='xhtml') assert '' in rslt assert '' in rslt assert 'Section Title' in rslt assert '