Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wbond/pybars3
Browse files Browse the repository at this point in the history
* 'master' of github.com:wbond/pybars3:
  Add tests for if not/else
  Add a positive test case to test_inverted_alternate_sections
  • Loading branch information
isaacdd committed Sep 18, 2016
2 parents 8be45cf + f680447 commit 7f00438
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/test_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,17 +477,11 @@ def test_inverted_alternate_sections(self):
)
result = "Right On!\nRight On!"

context = {}

self.assertRender(template, context, result)
self.assertRender(template, {}, result)
self.assertRender(template, {'goodbyes': False}, result)
self.assertRender(template, {'goodbyes': []}, result)

context = {'goodbyes': False}

self.assertRender(template, context, result)

context = {'goodbyes': []}

self.assertRender(template, context, result)
self.assertRender(template, {'goodbyes': ['Hello', 'world!']}, u"Helloworld!\nHelloworld!")

def test_array_iteration(self):
template = u"{{#goodbyes}}{{text}}! {{/goodbyes}}cruel {{world}}!"
Expand Down Expand Up @@ -1617,6 +1611,15 @@ def test_if_else(self):

self.assertRender(template, context, result)

template = u"{{^if goodbye}}Hello{{else}}GOODBYE{{/if}}"

self.assertRender(template, {}, u"Hello")
self.assertRender(template, {'goodbye': True}, u"GOODBYE")
self.assertRender(template, {'goodbye': "goodbye"}, u"GOODBYE")
self.assertRender(template, {'goodbye': False}, u"Hello")
self.assertRender(template, {'hello': 'hello'}, u"Hello")


def test_if_with_function_argument(self):
template = u"{{#if goodbye}}GOODBYE {{/if}}cruel {{world}}!"

Expand Down

0 comments on commit 7f00438

Please sign in to comment.