Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
f9bda3a5
Commit
f9bda3a5
authored
Apr 08, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Python 3 unit test fixes; README doctests also now working.
parent
b042d084
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
9 deletions
+31
-9
pystache/__init__.py
+1
-1
pystache/parser.py
+1
-1
pystache/renderengine.py
+1
-1
pystache/tests/test_locator.py
+1
-1
pystache/tests/test_renderengine.py
+23
-5
setup.py
+4
-0
No files found.
pystache/__init__.py
View file @
f9bda3a5
# We keep all initialization code in a separate module.
from
init
import
*
from
pystache.
init
import
*
pystache/parser.py
View file @
f9bda3a5
...
...
@@ -9,7 +9,7 @@ This module is only meant for internal use by the renderengine module.
import
re
from
parsed
import
ParsedTemplate
from
p
ystache.p
arsed
import
ParsedTemplate
DEFAULT_DELIMITERS
=
(
'{{'
,
'}}'
)
...
...
pystache/renderengine.py
View file @
f9bda3a5
...
...
@@ -7,7 +7,7 @@ Defines a class responsible for rendering logic.
import
re
from
parser
import
Parser
from
p
ystache.p
arser
import
Parser
class
RenderEngine
(
object
):
...
...
pystache/tests/test_locator.py
View file @
f9bda3a5
...
...
@@ -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
):
...
...
pystache/tests/test_renderengine.py
View file @
f9bda3a5
...
...
@@ -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
)
...
...
setup.py
View file @
f9bda3a5
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment