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
c414a5ca
Commit
c414a5ca
authored
Apr 08, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made 6 more tests pass in Python 3 (and simultaneously, Python 2)..
parent
50d6a535
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
pystache/tests/common.py
+5
-0
pystache/tests/test_loader.py
+13
-0
No files found.
pystache/tests/common.py
View file @
c414a5ca
...
@@ -12,6 +12,7 @@ import pystache
...
@@ -12,6 +12,7 @@ import pystache
from
pystache
import
defaults
from
pystache
import
defaults
# Save a reference to the original function to avoid recursion.
_DEFAULT_TAG_ESCAPE
=
defaults
.
TAG_ESCAPE
_DEFAULT_TAG_ESCAPE
=
defaults
.
TAG_ESCAPE
_TESTS_DIR
=
os
.
path
.
dirname
(
pystache
.
tests
.
__file__
)
_TESTS_DIR
=
os
.
path
.
dirname
(
pystache
.
tests
.
__file__
)
...
@@ -29,6 +30,10 @@ def html_escape(u):
...
@@ -29,6 +30,10 @@ def html_escape(u):
This function is needed because single quotes are escaped in Python 3
This function is needed because single quotes are escaped in Python 3
(to '''), but not in Python 2.
(to '''), but not in Python 2.
The global defaults.TAG_ESCAPE can be set to this function in the
setUp() and tearDown() of unittest test cases, for example, for
consistent test results.
"""
"""
u
=
_DEFAULT_TAG_ESCAPE
(
u
)
u
=
_DEFAULT_TAG_ESCAPE
(
u
)
return
u
.
replace
(
"'"
,
'''
)
return
u
.
replace
(
"'"
,
'''
)
...
...
pystache/tests/test_loader.py
View file @
c414a5ca
...
@@ -16,6 +16,19 @@ from pystache.loader import Loader
...
@@ -16,6 +16,19 @@ from pystache.loader import Loader
class
LoaderTests
(
unittest
.
TestCase
,
AssertStringMixin
):
class
LoaderTests
(
unittest
.
TestCase
,
AssertStringMixin
):
# Switching to standard encodings allows for consistent test
# results across Python 2/3.
def
setUp
(
self
):
self
.
original_string_encoding
=
defaults
.
STRING_ENCODING
self
.
original_file_encoding
=
defaults
.
FILE_ENCODING
defaults
.
STRING_ENCODING
=
'ascii'
defaults
.
FILE_ENCODING
=
'ascii'
def
tearDown
(
self
):
defaults
.
STRING_ENCODING
=
self
.
original_string_encoding
defaults
.
FILE_ENCODING
=
self
.
original_file_encoding
def
test_init__extension
(
self
):
def
test_init__extension
(
self
):
loader
=
Loader
(
extension
=
'foo'
)
loader
=
Loader
(
extension
=
'foo'
)
self
.
assertEqual
(
loader
.
extension
,
'foo'
)
self
.
assertEqual
(
loader
.
extension
,
'foo'
)
...
...
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