pystache.tests.test_renderer module

Unit tests of template.py.

class pystache.tests.test_renderer.RendererInitTestCase(methodName='runTest')[source]

Bases: TestCase

Tests the Renderer.__init__() method.

test_decode_errors()[source]

Check that the constructor sets the attribute correctly.

test_decode_errors__default()[source]

Check the default value.

test_escape()[source]
test_escape__default()[source]
test_file_encoding()[source]

Check that the file_encoding attribute is set correctly.

test_file_encoding__default()[source]

Check the file_encoding default.

test_file_extension()[source]

Check that the file_encoding attribute is set correctly.

test_file_extension__default()[source]

Check the file_extension default.

test_missing_tags()[source]

Check that the missing_tags attribute is set correctly.

test_missing_tags__default()[source]

Check the missing_tags default.

test_partials()[source]

Test that the attribute is set correctly.

test_partials__default()[source]

Test the default value.

test_search_dirs__default()[source]

Check the search_dirs default.

test_search_dirs__list()[source]

Check that the search_dirs attribute is set correctly when a list.

test_search_dirs__string()[source]

Check that the search_dirs attribute is set correctly when a string.

test_string_encoding()[source]

Check that the constructor sets the attribute correctly.

test_string_encoding__default()[source]

Check the default value.

class pystache.tests.test_renderer.RendererTests(methodName='runTest')[source]

Bases: TestCase, AssertStringMixin

Test the Renderer class.

test__make_loader__attributes()[source]

Test that _make_loader() sets all attributes correctly..

test__make_loader__return_type()[source]

Test that _make_loader() returns a Loader.

test_custom_string_coercion_via_assignment()[source]

Test that string coercion can be customized via attribute assignment.

test_custom_string_coercion_via_subclassing()[source]

Test that string coercion can be customized via subclassing.

test_make_resolve_partial()[source]

Test the _make_resolve_partial() method.

test_make_resolve_partial__unicode()[source]

Test _make_resolve_partial(): that resolve_partial doesn’t “double-decode” Unicode.

test_render__context()[source]

Test render(): passing a context.

test_render__context_and_kwargs()[source]

Test render(): passing a context and kwargs.

test_render__context_and_kwargs__precedence()[source]

Test render(): kwargs takes precedence over context.

test_render__kwargs_and_no_context()[source]

Test render(): passing kwargs and no context.

test_render__kwargs_does_not_modify_context()[source]

Test render(): passing kwargs does not modify the passed context.

test_render__non_ascii_character()[source]
test_render__nonascii_template()[source]

Test passing a non-unicode template with non-ascii characters.

test_render__object()[source]

Test rendering an object instance.

test_render__return_type()[source]

Check that render() returns a string of type unicode.

test_render__str()[source]
test_render__template_spec()[source]

Test rendering a TemplateSpec instance.

test_render__unicode()[source]
test_render__view()[source]

Test rendering a View instance.

test_render_name()[source]

Test the render_name() method.

test_render_path()[source]

Test the render_path() method.

test_unicode__decode_errors()[source]

Test that the decode_errors attribute is respected.

test_unicode__string_encoding()[source]

Test that the string_encoding attribute is respected.

class pystache.tests.test_renderer.Renderer_MakeRenderEngineTests(methodName='runTest')[source]

Bases: TestCase, AssertStringMixin, AssertExceptionMixin

Check the RenderEngine returned by Renderer._make_render_engine().

test__escape__has_access_to_original_unicode_subclass()[source]

Test that escape receives strings with the unicode subclass intact.

test__escape__returns_unicode()[source]

Test that literal returns unicode (and not a subclass).

test__escape__uses_renderer_escape()[source]

Test that escape uses the renderer’s escape function.

test__escape__uses_renderer_unicode()[source]

Test that escape uses the renderer’s unicode function.

test__literal__handles_unicode()[source]

Test that literal doesn’t try to “double decode” unicode.

test__literal__returns_unicode()[source]

Test that literal returns unicode (and not a subclass).

test__literal__uses_renderer_unicode()[source]

Test that literal uses the renderer’s unicode function.

test__missing_tags__unknown_value()[source]

Check missing_tags attribute: setting an unknown value.

test__resolve_context()[source]

Check resolve_context(): default arguments.

test__resolve_context__missing_tags_strict()[source]

Check resolve_context(): missing_tags ‘strict’.

test__resolve_partial__not_found()[source]

Check that resolve_partial returns the empty string when a template is not found.

test__resolve_partial__not_found__missing_tags_strict()[source]

Check that resolve_partial provides a nice message when a template is not found.

test__resolve_partial__not_found__partials_dict()[source]

Check that resolve_partial returns the empty string when a template is not found.

test__resolve_partial__not_found__partials_dict__missing_tags_strict()[source]

Check that resolve_partial provides a nice message when a template is not found.

test__resolve_partial__returns_unicode()[source]

Check that resolve_partial returns unicode (and not a subclass).

pystache.tests.test_renderer.mock_unicode(b, encoding=None)[source]