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
6d3d9db3
Commit
6d3d9db3
authored
Mar 13, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more tests to document the behavior before the
next docutils upgrade
parent
54e2a41d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
lib/python/reStructuredText/__init__.py
lib/python/reStructuredText/__init__.py
+4
-1
lib/python/reStructuredText/tests/testReST.py
lib/python/reStructuredText/tests/testReST.py
+56
-0
No files found.
lib/python/reStructuredText/__init__.py
View file @
6d3d9db3
...
...
@@ -152,6 +152,9 @@ def HTML(src,
warnings
=
''
.
join
(
warning_stream
.
messages
)
if
output_encoding
!=
'unicode'
:
return
output
.
encode
(
output_encoding
)
else
:
return
output
__all__
=
(
"HTML"
,
'render'
)
lib/python/reStructuredText/tests/testReST.py
View file @
6d3d9db3
# -*- coding: iso-8859-15 -*-
import
unittest
from
reStructuredText
import
HTML
txt
=
"""Hello World
============
text text
Von Vgeln und fen
===================
- some
- more
- text
"""
class
TestReST
(
unittest
.
TestCase
):
...
...
@@ -8,6 +26,44 @@ class TestReST(unittest.TestCase):
# Make sure we can import the rst parser
from
docutils.parsers
import
rst
def
testEncodings
(
self
):
def
_test
(
txt
,
in_enc
,
out_enc
):
return
HTML
(
txt
,
input_encoding
=
in_enc
,
output_encoding
=
out_enc
)
encoding
=
'iso-8859-15'
html
=
_test
(
txt
,
encoding
,
encoding
)
self
.
assertEqual
(
'Vgel'
in
html
,
True
)
self
.
assertEqual
(
'fen'
in
html
,
True
)
html
=
_test
(
txt
,
encoding
,
'unicode'
)
self
.
assertEqual
(
unicode
(
'Vgel'
,
encoding
)
in
html
,
True
)
self
.
assertEqual
(
unicode
(
'fen'
,
encoding
)
in
html
,
True
)
html
=
_test
(
unicode
(
txt
,
encoding
),
'unicode'
,
encoding
)
self
.
assertEqual
(
'Vgel'
in
html
,
True
)
self
.
assertEqual
(
'fen'
in
html
,
True
)
html
=
_test
(
unicode
(
txt
,
encoding
),
'unicode'
,
'unicode'
)
self
.
assertEqual
(
unicode
(
'Vgel'
,
encoding
)
in
html
,
True
)
self
.
assertEqual
(
unicode
(
'fen'
,
encoding
)
in
html
,
True
)
def
testHeaderLevel
(
self
):
encoding
=
'iso-8859-15'
for
level
in
range
(
0
,
5
):
html
=
HTML
(
txt
,
input_encoding
=
encoding
,
output_encoding
=
encoding
,
initial_header_level
=
level
)
self
.
assertEqual
(
'<h%d><a name="hello-world">Hello World</a></h%d>'
\
%
(
level
+
1
,
level
+
1
)
in
html
,
True
)
self
.
assertEqual
(
'<h%d><a name="von-v-geln-und-fen">Von Vgeln und fen</a></h%d>'
\
%
(
level
+
1
,
level
+
1
)
in
html
,
True
)
def
test_suite
():
from
unittest
import
TestSuite
,
makeSuite
...
...
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