def test_make_resolve_partial__unicode(self): """ Test _make_resolve_partial(): that resolve_partial doesn't "double-decode" Unicode. """ renderer = Renderer() renderer.partials = {'partial': 'foo'} resolve_partial = renderer._make_resolve_partial() self.assertEqual(resolve_partial("partial"), "foo") # Now with a value that is already unicode. renderer.partials = {'partial': 'foo'} resolve_partial = renderer._make_resolve_partial() # If the next line failed, we would get the following error: # TypeError: decoding Unicode is not supported self.assertEqual(resolve_partial("partial"), "foo")
def test_make_resolve_partial(self): """ Test the _make_resolve_partial() method. """ renderer = Renderer() renderer.partials = {'foo': 'bar'} resolve_partial = renderer._make_resolve_partial() actual = resolve_partial('foo') self.assertEqual(actual, 'bar') self.assertEqual(type(actual), str, "RenderEngine requires that " "resolve_partial return unicode strings.")
def test_make_resolve_partial(self): """ Test the _make_resolve_partial() method. """ renderer = Renderer() renderer.partials = {'foo': 'bar'} resolve_partial = renderer._make_resolve_partial() actual = resolve_partial('foo') self.assertEqual(actual, 'bar') self.assertEqual( type(actual), str, "RenderEngine requires that " "resolve_partial return unicode strings.")