summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pystache/__init__.py2
-rw-r--r--pystache/parser.py2
-rw-r--r--pystache/renderengine.py2
-rw-r--r--pystache/tests/test_locator.py2
-rw-r--r--pystache/tests/test_renderengine.py28
-rw-r--r--setup.py4
6 files changed, 31 insertions, 9 deletions
diff --git a/pystache/__init__.py b/pystache/__init__.py
index daf7f52..c1070e3 100644
--- a/pystache/__init__.py
+++ b/pystache/__init__.py
@@ -1,2 +1,2 @@
# We keep all initialization code in a separate module.
-from init import *
+from pystache.init import *
diff --git a/pystache/parser.py b/pystache/parser.py
index 2b96249..ccb6827 100644
--- a/pystache/parser.py
+++ b/pystache/parser.py
@@ -9,7 +9,7 @@ This module is only meant for internal use by the renderengine module.
import re
-from parsed import ParsedTemplate
+from pystache.parsed import ParsedTemplate
DEFAULT_DELIMITERS = ('{{', '}}')
diff --git a/pystache/renderengine.py b/pystache/renderengine.py
index e91d019..d9c822c 100644
--- a/pystache/renderengine.py
+++ b/pystache/renderengine.py
@@ -7,7 +7,7 @@ Defines a class responsible for rendering logic.
import re
-from parser import Parser
+from pystache.parser import Parser
class RenderEngine(object):
diff --git a/pystache/tests/test_locator.py b/pystache/tests/test_locator.py
index 2ae07ca..ddebef8 100644
--- a/pystache/tests/test_locator.py
+++ b/pystache/tests/test_locator.py
@@ -15,7 +15,7 @@ from pystache.loader import Loader as Reader
from pystache.locator import Locator
from pystache.tests.common import DATA_DIR
-from data.views import SayHello
+from pystache.tests.data.views import SayHello
class LocatorTests(unittest.TestCase):
diff --git a/pystache/tests/test_renderengine.py b/pystache/tests/test_renderengine.py
index 52f4bfe..3c63cfb 100644
--- a/pystache/tests/test_renderengine.py
+++ b/pystache/tests/test_renderengine.py
@@ -14,6 +14,27 @@ from pystache.renderengine import RenderEngine
from pystache.tests.common import AssertStringMixin
+def mock_literal(s):
+ """
+ For use as the literal keyword argument to the RenderEngine constructor.
+
+ Arguments:
+
+ s: a byte string or unicode string.
+
+ """
+ if isinstance(s, unicode):
+ # Strip off unicode super classes, if present.
+ u = unicode(s)
+ else:
+ u = unicode(s, encoding='ascii')
+
+ # We apply upper() to make sure we are actually using our custom
+ # function in the tests
+ return u.upper()
+
+
+
class RenderEngineTestCase(unittest.TestCase):
"""Test the RenderEngine class."""
@@ -154,12 +175,9 @@ class RenderTests(unittest.TestCase, AssertStringMixin):
Test a context value that is not a basestring instance.
"""
- # We use include upper() to make sure we are actually using
- # our custom function in the tests
- to_unicode = lambda s: unicode(s, encoding='ascii').upper()
engine = self._engine()
- engine.escape = to_unicode
- engine.literal = to_unicode
+ engine.escape = mock_literal
+ engine.literal = mock_literal
self.assertRaises(TypeError, engine.literal, 100)
diff --git a/setup.py b/setup.py
index 461e43f..796654e 100644
--- a/setup.py
+++ b/setup.py
@@ -84,6 +84,7 @@ else:
# troubleshoot it while using Python 2.7 instead of Python 3.
extra = {
'use_2to3': True,
+ 'convert_2to3_doctests': ['README.rst'],
}
setup(name='pystache',
@@ -97,6 +98,9 @@ setup(name='pystache',
url='http://github.com/defunkt/pystache',
packages=find_packages(),
package_data = {
+ # Include the README so doctests can be run.
+ # TODO: is there a better way to include the README?
+ 'pystache': ['../README.rst'],
# Include template files so tests can be run.
'examples': template_files,
'pystache.tests.data': template_files,