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
1a4ed4ce
Commit
1a4ed4ce
authored
Feb 02, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests for issue #11159.
parent
5a9c1a75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
Lib/test/test_sax.py
Lib/test/test_sax.py
+16
-0
No files found.
Lib/test/test_sax.py
View file @
1a4ed4ce
...
@@ -14,6 +14,7 @@ from xml.sax.expatreader import create_parser
...
@@ -14,6 +14,7 @@ from xml.sax.expatreader import create_parser
from
xml.sax.handler
import
feature_namespaces
from
xml.sax.handler
import
feature_namespaces
from
xml.sax.xmlreader
import
InputSource
,
AttributesImpl
,
AttributesNSImpl
from
xml.sax.xmlreader
import
InputSource
,
AttributesImpl
,
AttributesNSImpl
from
io
import
StringIO
from
io
import
StringIO
import
os.path
import
shutil
import
shutil
from
test
import
support
from
test
import
support
from
test.support
import
findfile
,
run_unittest
from
test.support
import
findfile
,
run_unittest
...
@@ -27,6 +28,18 @@ try:
...
@@ -27,6 +28,18 @@ try:
except
UnicodeEncodeError
:
except
UnicodeEncodeError
:
raise
unittest
.
SkipTest
(
"filename is not encodable to utf8"
)
raise
unittest
.
SkipTest
(
"filename is not encodable to utf8"
)
supports_nonascii_filenames
=
True
if
not
os
.
path
.
supports_unicode_filenames
:
try
:
support
.
TESTFN_UNICODE
.
encode
(
support
.
TESTFN_ENCODING
)
except
(
UnicodeError
,
TypeError
):
# Either the file system encoding is None, or the file name
# cannot be encoded in the file system encoding.
supports_nonascii_filenames
=
False
requires_nonascii_filenames
=
unittest
.
skipUnless
(
supports_nonascii_filenames
,
'Requires non-ascii filenames support'
)
ns_uri
=
"http://www.python.org/xml-ns/saxtest/"
ns_uri
=
"http://www.python.org/xml-ns/saxtest/"
class
XmlTestBase
(
unittest
.
TestCase
):
class
XmlTestBase
(
unittest
.
TestCase
):
...
@@ -483,6 +496,7 @@ class ExpatReaderTest(XmlTestBase):
...
@@ -483,6 +496,7 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
@
requires_nonascii_filenames
def
test_expat_file_nonascii
(
self
):
def
test_expat_file_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
...
@@ -636,6 +650,7 @@ class ExpatReaderTest(XmlTestBase):
...
@@ -636,6 +650,7 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
self
.
assertEqual
(
result
.
getvalue
(),
xml_test_out
)
@
requires_nonascii_filenames
def
test_expat_inpsource_sysid_nonascii
(
self
):
def
test_expat_inpsource_sysid_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
...
@@ -724,6 +739,7 @@ class ExpatReaderTest(XmlTestBase):
...
@@ -724,6 +739,7 @@ class ExpatReaderTest(XmlTestBase):
self
.
assertEqual
(
parser
.
getSystemId
(),
TEST_XMLFILE
)
self
.
assertEqual
(
parser
.
getSystemId
(),
TEST_XMLFILE
)
self
.
assertEqual
(
parser
.
getPublicId
(),
None
)
self
.
assertEqual
(
parser
.
getPublicId
(),
None
)
@
requires_nonascii_filenames
def
test_expat_locator_withinfo_nonascii
(
self
):
def
test_expat_locator_withinfo_nonascii
(
self
):
fname
=
support
.
TESTFN_UNICODE
fname
=
support
.
TESTFN_UNICODE
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
shutil
.
copyfile
(
TEST_XMLFILE
,
fname
)
...
...
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