Browse Source

Fixed a failing test

main
Lakshmi Vyasarajan 14 years ago
parent
commit
e78cb1db04
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      hyde/tests/test_jinja2template.py

+ 9
- 0
hyde/tests/test_jinja2template.py View File

@@ -85,6 +85,7 @@ def test_typogrify():
""" """
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
assert html == u'One <span class="amp">&amp;</span>&nbsp;two' assert html == u'One <span class="amp">&amp;</span>&nbsp;two'


@@ -110,6 +111,7 @@ def test_spaceless():
""" """
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
expected = u""" expected = u"""
<html><body><ul><li> <html><body><ul><li>
@@ -146,6 +148,7 @@ def test_markdown_with_extensions():
c = Config(JINJA2.path, config_dict=dict(markdown=dict(extensions=['headerid']))) c = Config(JINJA2.path, config_dict=dict(markdown=dict(extensions=['headerid'])))
s.config = c s.config = c
t.configure(s) t.configure(s)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
assert html == u'<h3 id="heading_3">Heading 3</h3>' assert html == u'<h3 id="heading_3">Heading 3</h3>'


@@ -162,6 +165,7 @@ def test_line_statements():
c = Config(JINJA2.path, config_dict=dict(markdown=dict(extensions=['headerid']))) c = Config(JINJA2.path, config_dict=dict(markdown=dict(extensions=['headerid'])))
s.config = c s.config = c
t.configure(s) t.configure(s)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
assert html == u'<h3 id="heading_3">Heading 3</h3>' assert html == u'<h3 id="heading_3">Heading 3</h3>'


@@ -184,6 +188,7 @@ def test_line_statements_with_config():
s = Site(JINJA2.path) s = Site(JINJA2.path)
s.config = Config(JINJA2.path, config_dict=yaml.load(config)) s.config = Config(JINJA2.path, config_dict=yaml.load(config))
t.configure(s) t.configure(s)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip() html = t.render(source, {}).strip()
assert html == u'<h3 id="heading_3">Heading 3</h3>' assert html == u'<h3 id="heading_3">Heading 3</h3>'


@@ -221,6 +226,7 @@ class TestJinjaTemplate(object):
def test_depends(self): def test_depends(self):
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
t.env.filters['dateformat'] = dateformat
deps = list(t.get_dependencies('index.html')) deps = list(t.get_dependencies('index.html'))
assert len(deps) == 2 assert len(deps) == 2


@@ -258,6 +264,7 @@ class TestJinjaTemplate(object):
gen = Generator(site) gen = Generator(site)
gen.load_template_if_needed() gen.load_template_if_needed()
template = gen.template template = gen.template
template.env.filters['dateformat'] = dateformat
html = template.render(text, {}).strip() html = template.render(text, {}).strip()


assert html assert html
@@ -538,6 +545,7 @@ two:
""" """
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
t.env.filters['dateformat'] = dateformat
html = t.render(text, {}).strip() html = t.render(text, {}).strip()
actual = PyQuery(html) actual = PyQuery(html)
assert actual("ul").length == 2 assert actual("ul").length == 2
@@ -580,6 +588,7 @@ item_list:
""" """
t = Jinja2Template(JINJA2.path) t = Jinja2Template(JINJA2.path)
t.configure(None) t.configure(None)
t.env.filters['dateformat'] = dateformat
html = t.render(text, {}).strip() html = t.render(text, {}).strip()
print html print html
actual = PyQuery(html) actual = PyQuery(html)


||||||
x
 
000:0
Loading…
Cancel
Save