Commit fe7f6511 by Chris Jerdonek

Added missing_tags attribute validation.

parent 87dfefc2
......@@ -263,7 +263,14 @@ class Renderer(object):
Return whether missing_tags is set to strict.
"""
return self.missing_tags == MissingTags.strict
val = self.missing_tags
if val == MissingTags.strict:
return True
elif val == MissingTags.ignore:
return False
raise Exception("Unsupported 'missing_tags' value: %s" % repr(val))
def _make_resolve_partial(self):
"""
......
......@@ -639,6 +639,19 @@ class Renderer_MakeRenderEngineTests(unittest.TestCase, AssertStringMixin, Asser
self.assertTrue(isinstance(s, unicode))
self.assertEqual(type(escape(s)), unicode)
## Test the missing_tags attribute.
def test__missing_tags__unknown_value(self):
"""
Check missing_tags attribute: setting an unknown value.
"""
renderer = Renderer()
renderer.missing_tags = 'foo'
self.assertException(Exception, "Unsupported 'missing_tags' value: 'foo'",
renderer._make_render_engine)
## Test the engine's resolve_context attribute.
def test__resolve_context(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment