Skip to content

Commit

Permalink
Fix the failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
M. Mert Yildiran committed Jan 13, 2021
1 parent 971e4b2 commit 9873ae7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/test_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def test_current_context_does_not_invoke_helpers(self):
template = u"test: {{.}}"
result = u"test: "

self.assertRender(template, None, result, helpers)
self.assertRender(template, None, result, helpers, error='Could not find variable ')

def test_complex_but_empty_paths(self):
template = u"{{person/name}}"
Expand All @@ -489,15 +489,15 @@ def test_complex_but_empty_paths(self):
}
result = u""

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable None')

template = u"{{person/name}}"
context = {
'person': {}
}
result = u""

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable None')

def test_this_keyword_in_paths_simple(self):
template = u"{{#goodbyes}}{{this}}{{/goodbyes}}"
Expand Down Expand Up @@ -548,18 +548,18 @@ def helper(this, value):
self.assertRender(template, context, result, helpers=helpers)

def test_pass_number_literal(self):
self.assertRender(u"{{12}}", {}, u"")
self.assertRender(u"{{12}}", {}, u"", error='Could not find variable 12')
self.assertRender(u"{{12}}", {'12': 'bar'}, u"bar")
self.assertRender(u"{{12.34}}", {}, u"")
self.assertRender(u"{{12.34}}", {}, u"", error='Could not find variable None')
# FIXME the two cases below currently fail, it is also the case for non-numeric variables
# self.assertRender(u"{{12.34}}", {'12.34': 'bar'}, u"bar")
# def func(this, arg):
# return 'bar' + str(arg)
# self.assertRender(u"{{12.34 1}}", {'12.34': func}, u"bar1")

def test_pass_boolean_literal(self):
self.assertRender(u"{{true}}", {}, u"")
self.assertRender(u"{{true}}", {'': 'foo'}, u"")
self.assertRender(u"{{true}}", {}, u"", error='Could not find variable true')
self.assertRender(u"{{true}}", {'': 'foo'}, u"", error='Could not find variable true')
self.assertRender(u"{{false}}", {'false': 'foo'}, u"foo")

def test_inverted_sections(self):
Expand Down Expand Up @@ -1584,7 +1584,7 @@ def test_none(self):
}
result = u""

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable var')

def test_none_unescaped(self):
template = u"{{{var}}}"
Expand All @@ -1593,7 +1593,7 @@ def test_none_unescaped(self):
}
result = u""

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable var')

def test_null(self):

Expand Down Expand Up @@ -1821,7 +1821,7 @@ def test_default_helperMissing_no_params(self):
context = {}
result = u"ab"

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable missing')

def test_default_helperMissing_with_param(self):
template = u"a{{missing something}}b"
Expand Down Expand Up @@ -2130,7 +2130,7 @@ def test_each_with_nested_index(self):
}
result = u"0. goodbye! 0 1 2 After 0 1. Goodbye! 0 1 2 After 1 2. GOODBYE! 0 1 2 After 2 cruel world!"

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable @index')

def test_each_with_parent_index(self):
template = u"{{#each people}}{{#each foods}}{{../name}}({{@../index}}) likes {{name}}({{@index}}), {{/each}}{{/each}}"
Expand Down Expand Up @@ -2167,7 +2167,7 @@ def test_log(self):
original_log = pybars.log
pybars.log = log.append

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable log')
self.assertEqual(["whee"], log)

pybars.log = original_log
Expand All @@ -2176,7 +2176,7 @@ def test_log_underlying_function(self):
# log implementation and test are just stubs
template = u"{{log '123'}}"
result = ''
self.assertRender(template, {}, result)
self.assertRender(template, {}, result, error='Could not find variable log')

def test_overriding_property_lookup(self):
pass
Expand Down Expand Up @@ -2353,7 +2353,7 @@ def test_should_not_fail_on_undefined_value(self):
}
result = ''

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable lookup')

def test_should_not_fail_on_unavailable_value(self):
template = u'{{lookup thelist 3}}.{{lookup theobject "qux"}}.{{lookup thenumber 0}}'
Expand All @@ -2369,7 +2369,7 @@ def test_should_not_fail_on_unavailable_value(self):
}
result = '..'

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable lookup')

def test_should_lookup_content_by_special_variables(self):
template = u'{{#each goodbyes}}{{lookup ../data @index}}{{/each}}'
Expand Down Expand Up @@ -2404,7 +2404,7 @@ def test_cannot_read_property_of_undefined(self):
}
result = u"The origin of speciesCharles DarwinLazarillo de Tormes"

self.assertRender(template, context, result)
self.assertRender(template, context, result, error='Could not find variable None')

def test_inverted_sections_print_when_they_shouldnt(self):
template = u"{{^set}}not set{{/set}} :: {{#set}}set{{/set}}"
Expand Down

0 comments on commit 9873ae7

Please sign in to comment.