Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
efbf40f9
Commit
efbf40f9
authored
Feb 02, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #11159: Add tests for testing SAX parser support of non-ascii file names.
parents
380f7a18
d5202396
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
Lib/test/test_sax.py
Lib/test/test_sax.py
+44
-0
No files found.
Lib/test/test_sax.py
View file @
efbf40f9
...
...
@@ -14,6 +14,8 @@ from xml.sax.expatreader import create_parser
from
xml.sax.handler
import
feature_namespaces
from
xml.sax.xmlreader
import
InputSource
,
AttributesImpl
,
AttributesNSImpl
from
io
import
StringIO
import
shutil
from
test
import
support
from
test.support
import
findfile
,
run_unittest
import
unittest
...
...
@@ -481,6 +483,20 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
def
test_expat_file_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
self
.
addCleanup
(
support
.
unlink
,
fname
)
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
open
(
fname
))
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
# ===== DTDHandler support
class
TestDTDHandler
:
...
...
@@ -620,6 +636,20 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
def
test_expat_inpsource_sysid_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
self
.
addCleanup
(
support
.
unlink
,
fname
)
parser
=
create_parser
()
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
InputSource
(
fname
))
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
def
test_expat_inpsource_stream
(
self
):
parser
=
create_parser
()
result
=
StringIO
()
...
...
@@ -694,6 +724,20 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
parser
.
getSystemId
(),
TEST_XMLFILE
)
self
.
assertEqual
(
parser
.
getPublicId
(),
None
)
def
test_expat_locator_withinfo_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
self
.
addCleanup
(
support
.
unlink
,
fname
)
result
=
StringIO
()
xmlgen
=
XMLGenerator
(
result
)
parser
=
create_parser
()
parser
.
setContentHandler
(
xmlgen
)
parser
.
parse
(
fname
)
self
.
assertEqual
(
parser
.
getSystemId
(),
fname
)
self
.
assertEqual
(
parser
.
getPublicId
(),
None
)
# ===========================================================================
#
...
...
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