Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-mako
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-mako
Commits
64c7ba7b
Commit
64c7ba7b
authored
18 years ago
by
Mike Bayer
Browse files
Options
Downloads
Patches
Plain Diff
unit tests for input_encoding, non double-decode of unicode object
parent
902519ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/template.py
+12
-1
12 additions, 1 deletion
test/template.py
with
12 additions
and
1 deletion
test/template.py
+
12
−
1
View file @
64c7ba7b
...
...
@@ -56,7 +56,18 @@ class EncodingTest(unittest.TestCase):
% endif
"""
.
encode
(
'
utf-8
'
))
assert
template
.
render_unicode
().
strip
()
==
u
"""
hi, drôle de petit voix m’a réveillé.
"""
def
test_input_encoding
(
self
):
"""
test the
'
input_encoding
'
flag on Template, and that unicode objects arent double-decoded
"""
s2
=
u
"
hello ${f(u
'
śląsk
'
)}
"
res
=
Template
(
s2
,
input_encoding
=
'
utf-8
'
).
render_unicode
(
f
=
lambda
x
:
x
)
assert
res
==
u
"
hello śląsk
"
s2
=
u
"
# -*- coding: utf-8 -*-
\n
hello ${f(u
'
śląsk
'
)}
"
res
=
Template
(
s2
).
render_unicode
(
f
=
lambda
x
:
x
)
assert
res
==
u
"
hello śląsk
"
def
test_encoding
(
self
):
val
=
u
"""
Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petit voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »
"""
template
=
Template
(
val
,
output_encoding
=
'
utf-8
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment