Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
168d3c2e
Commit
168d3c2e
authored
Jan 08, 2007
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge from HEAD
parent
6118ff0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
1 deletion
+39
-1
lib/python/Products/PageTemplates/tests/testExpressions.py
lib/python/Products/PageTemplates/tests/testExpressions.py
+39
-1
No files found.
lib/python/Products/PageTemplates/tests/testExpressions.py
View file @
168d3c2e
import
unittest
import
zope.component
import
zope.component.testing
from
zope.traversing.adapters
import
DefaultTraversable
from
Products.PageTemplates
import
Expressions
from
Products.PageTemplates.DeferExpr
import
LazyWrapper
from
Products.PageTemplates.DeferExpr
import
DeferWrapper
from
Products.PageTemplates.unicodeconflictresolver
import
\
DefaultUnicodeEncodingConflictResolver
,
\
StrictUnicodeEncodingConflictResolver
,
\
ReplacingUnicodeEncodingConflictResolver
,
\
IgnoringUnicodeEncodingConflictResolver
from
Products.PageTemplates.interfaces
import
IUnicodeEncodingConflictResolver
class
Dummy
:
__allow_access_to_unprotected_subobjects__
=
1
...
...
@@ -107,8 +115,38 @@ class ExpressionTests(zope.component.testing.PlacelessSetup, unittest.TestCase):
self
.
assertEquals
(
ec
.
evaluate
(
''
),
None
)
self
.
assertEquals
(
ec
.
evaluate
(
'
\
n
'
),
None
)
class
UnicodeEncodingConflictResolverTests
(
zope
.
component
.
testing
.
PlacelessSetup
,
unittest
.
TestCase
):
def
testDefaultResolver
(
self
):
zope
.
component
.
provideUtility
(
DefaultUnicodeEncodingConflictResolver
,
IUnicodeEncodingConflictResolver
)
resolver
=
zope
.
component
.
getUtility
(
IUnicodeEncodingConflictResolver
)
self
.
assertRaises
(
UnicodeDecodeError
,
resolver
.
resolve
,
None
,
''
,
None
)
def
testStrictResolver
(
self
):
zope
.
component
.
provideUtility
(
StrictUnicodeEncodingConflictResolver
,
IUnicodeEncodingConflictResolver
)
resolver
=
zope
.
component
.
getUtility
(
IUnicodeEncodingConflictResolver
)
self
.
assertRaises
(
UnicodeDecodeError
,
resolver
.
resolve
,
None
,
''
,
None
)
def
testIgnoringResolver
(
self
):
zope
.
component
.
provideUtility
(
IgnoringUnicodeEncodingConflictResolver
,
IUnicodeEncodingConflictResolver
)
resolver
=
zope
.
component
.
getUtility
(
IUnicodeEncodingConflictResolver
)
self
.
assertEqual
(
resolver
.
resolve
(
None
,
''
,
None
),
''
)
def
testReplacingResolver
(
self
):
zope
.
component
.
provideUtility
(
ReplacingUnicodeEncodingConflictResolver
,
IUnicodeEncodingConflictResolver
)
resolver
=
zope
.
component
.
getUtility
(
IUnicodeEncodingConflictResolver
)
self
.
assertEqual
(
resolver
.
resolve
(
None
,
''
,
None
),
u'
\
ufffd
\
ufffd
\
ufffd
'
)
def
test_suite
():
return
unittest
.
makeSuite
(
ExpressionTests
)
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
ExpressionTests
),
unittest
.
makeSuite
(
UnicodeEncodingConflictResolverTests
)
))
if
__name__
==
'__main__'
:
main
()
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