Contexts still can't see outer scope. Add failing test.

This commit is contained in:
Chris Wanstrath
2010-05-14 10:11:45 -07:00
parent 5cd466a679
commit 152c4e025f
3 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
{{#foo}}{{thing1}} and {{thing2}}{{/foo}}{{^foo}}Not foo!{{/foo}}
{{#foo}}{{thing1}} and {{thing2}} and {{outer_thing}}{{/foo}}{{^foo}}Not foo!{{/foo}}
+3
View File
@@ -3,5 +3,8 @@ import pystache
class NestedContext(pystache.View):
template_path = 'examples'
def outer_thing(self):
return "two"
def foo(self):
return {'thing1': 'one', 'thing2': 'foo'}
+1 -1
View File
@@ -69,7 +69,7 @@ Again, Welcome!
""")
def test_nested_context(self):
self.assertEquals(NestedContext().render(), "one and foo")
self.assertEquals(NestedContext().render(), "one and foo and two")
if __name__ == '__main__':
unittest.main()