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
1b18fb83
Commit
1b18fb83
authored
Mar 27, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed Loader to CustomLoader in test_custom_template.py.
parent
5f2e47ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
tests/test_custom_template.py
+16
-16
No files found.
tests/test_custom_template.py
View file @
1b18fb83
...
...
@@ -16,7 +16,7 @@ from examples.inverted import Inverted, InvertedLists
from
pystache
import
CustomizedTemplate
as
Template
from
pystache
import
Renderer
from
pystache
import
View
from
pystache.custom_template
import
Loader
from
pystache.custom_template
import
Loader
as
CustomLoader
from
pystache.locator
import
Locator
from
pystache.loader
import
Reader
from
.common
import
AssertIsMixin
...
...
@@ -136,15 +136,15 @@ class ViewTestCase(unittest.TestCase):
self
.
assertEquals
(
view
.
render
(),
"""one, two, three, empty list"""
)
class
LoaderTests
(
unittest
.
TestCase
,
AssertIsMixin
,
AssertStringMixin
):
class
Custom
LoaderTests
(
unittest
.
TestCase
,
AssertIsMixin
,
AssertStringMixin
):
"""
Tests custom_template.Loader.
Tests custom_template.
Custom
Loader.
"""
def
test_init__defaults
(
self
):
loader
=
Loader
()
loader
=
Custom
Loader
()
# Check the locator attribute.
locator
=
loader
.
locator
...
...
@@ -160,19 +160,19 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
def
test_init__search_dirs
(
self
):
search_dirs
=
[
'a'
,
'b'
]
loader
=
Loader
(
search_dirs
)
loader
=
Custom
Loader
(
search_dirs
)
self
.
assertEquals
(
loader
.
search_dirs
,
[
'a'
,
'b'
])
def
test_init__reader
(
self
):
reader
=
Reader
()
loader
=
Loader
([],
reader
=
reader
)
loader
=
Custom
Loader
([],
reader
=
reader
)
self
.
assertIs
(
loader
.
reader
,
reader
)
def
test_init__locator
(
self
):
locator
=
Locator
()
loader
=
Loader
([],
locator
=
locator
)
loader
=
Custom
Loader
([],
locator
=
locator
)
self
.
assertIs
(
loader
.
locator
,
locator
)
...
...
@@ -187,7 +187,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
custom
=
Template
()
custom
.
template
=
"abc"
self
.
_assert_template
(
Loader
(),
custom
,
u"abc"
)
self
.
_assert_template
(
Custom
Loader
(),
custom
,
u"abc"
)
def
test_load__template__type_unicode
(
self
):
"""
...
...
@@ -197,7 +197,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
custom
=
Template
()
custom
.
template
=
u"abc"
self
.
_assert_template
(
Loader
(),
custom
,
u"abc"
)
self
.
_assert_template
(
Custom
Loader
(),
custom
,
u"abc"
)
def
test_load__template__unicode_non_ascii
(
self
):
"""
...
...
@@ -207,7 +207,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
custom
=
Template
()
custom
.
template
=
u"é"
self
.
_assert_template
(
Loader
(),
custom
,
u"é"
)
self
.
_assert_template
(
Custom
Loader
(),
custom
,
u"é"
)
def
test_load__template__with_template_encoding
(
self
):
"""
...
...
@@ -217,10 +217,10 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
custom
=
Template
()
custom
.
template
=
u'é'
.
encode
(
'utf-8'
)
self
.
assertRaises
(
UnicodeDecodeError
,
self
.
_assert_template
,
Loader
(),
custom
,
u'é'
)
self
.
assertRaises
(
UnicodeDecodeError
,
self
.
_assert_template
,
Custom
Loader
(),
custom
,
u'é'
)
custom
.
template_encoding
=
'utf-8'
self
.
_assert_template
(
Loader
(),
custom
,
u'é'
)
self
.
_assert_template
(
Custom
Loader
(),
custom
,
u'é'
)
def
test_load__template__correct_reader
(
self
):
"""
...
...
@@ -228,7 +228,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
This test tests that the correct reader is called with the correct
arguments. This is a catch-all test to supplement the other
test cases. It tests Loader.load() independent of reader.unicode()
test cases. It tests
Custom
Loader.load() independent of reader.unicode()
being implemented correctly (and tested).
"""
...
...
@@ -244,7 +244,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
return
u"foo"
reader
=
TestReader
()
loader
=
Loader
()
loader
=
Custom
Loader
()
loader
.
reader
=
reader
custom
=
Template
()
...
...
@@ -256,7 +256,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
self
.
assertEquals
(
reader
.
encoding
,
"encoding-foo"
)
# TODO: migrate these tests into the LoaderTests class.
# TODO: migrate these tests into the
Custom
LoaderTests class.
# TODO: rename the get_template() tests to test load().
# TODO: condense, reorganize, and rename the tests so that it is
# clear whether we have full test coverage (e.g. organized by
...
...
@@ -265,7 +265,7 @@ class CustomizedTemplateTests(unittest.TestCase):
# TODO: rename this method to _make_loader().
def
_make_locator
(
self
):
locator
=
Loader
(
search_dirs
=
[
DATA_DIR
])
locator
=
Custom
Loader
(
search_dirs
=
[
DATA_DIR
])
return
locator
def
_assert_template_location
(
self
,
view
,
expected
):
...
...
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