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
23687043
Commit
23687043
authored
Feb 26, 2013
by
Eli Bendersky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cosmetic changes
parent
5b8a3242
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+9
-13
Lib/test/test_xml_etree_c.py
Lib/test/test_xml_etree_c.py
+4
-2
No files found.
Lib/test/test_xml_etree.py
View file @
23687043
# xml.etree test. This file contains enough tests to make sure that
# all included components work as they should.
# Large parts are extracted from the upstream test suite.
#
# PLEASE write all new tests using the standard unittest infrastructure and
# not doctest.
#
# IMPORTANT: the same tests are run from "test_xml_etree_c" in order
# to ensure consistency between the C implementation and the Python
# implementation.
#
# For this purpose, the module-level "ET" symbol is temporarily
# monkey-patched when running the "test_xml_etree_c" test suite.
# Don't re-import "xml.etree.ElementTree" module in the docstring,
# except if the test is specific to the Python implementation.
import
html
import
io
...
...
@@ -24,7 +15,7 @@ import weakref
from
itertools
import
product
from
test
import
support
from
test.support
import
TESTFN
,
findfile
,
unlink
,
import_fresh_module
,
gc_collect
from
test.support
import
TESTFN
,
findfile
,
import_fresh_module
,
gc_collect
# pyET is the pure-Python implementation.
#
...
...
@@ -97,6 +88,7 @@ ENTITY_XML = """\
class
ModuleTest
(
unittest
.
TestCase
):
# TODO: this should be removed once we get rid of the global module vars
def
test_sanity
(
self
):
# Import sanity.
...
...
@@ -528,7 +520,8 @@ class ElementTreeTest(unittest.TestCase):
events
=
(
"start"
,
"end"
,
"start-ns"
,
"end-ns"
)
context
=
iterparse
(
SIMPLE_NS_XMLFILE
,
events
)
self
.
assertEqual
([(
action
,
elem
.
tag
)
if
action
in
(
"start"
,
"end"
)
else
(
action
,
elem
)
self
.
assertEqual
([(
action
,
elem
.
tag
)
if
action
in
(
"start"
,
"end"
)
else
(
action
,
elem
)
for
action
,
elem
in
context
],
[
(
'start-ns'
,
(
''
,
'namespace'
)),
(
'start'
,
'{namespace}root'
),
...
...
@@ -1493,6 +1486,7 @@ class BasicElementTest(ElementTestCase, unittest.TestCase):
self
.
assertEqual
(
len
(
e2
),
2
)
self
.
assertEqualElements
(
e
,
e2
)
class
ElementTreeTypeTest
(
unittest
.
TestCase
):
def
test_istype
(
self
):
self
.
assertIsInstance
(
ET
.
ParseError
,
type
)
...
...
@@ -1861,7 +1855,9 @@ class XMLParserTest(unittest.TestCase):
self
.
_check_sample_element
(
parser
.
close
())
# Now as keyword args.
parser2
=
ET
.
XMLParser
(
encoding
=
'utf-8'
,
html
=
[{}],
target
=
ET
.
TreeBuilder
())
parser2
=
ET
.
XMLParser
(
encoding
=
'utf-8'
,
html
=
[{}],
target
=
ET
.
TreeBuilder
())
parser2
.
feed
(
self
.
sample1
)
self
.
_check_sample_element
(
parser2
.
close
())
...
...
@@ -1974,7 +1970,7 @@ class ElementSlicingTest(unittest.TestCase):
class
IOTest
(
unittest
.
TestCase
):
def
tearDown
(
self
):
unlink
(
TESTFN
)
support
.
unlink
(
TESTFN
)
def
test_encoding
(
self
):
# Test encoding issues.
...
...
Lib/test/test_xml_etree_c.py
View file @
23687043
...
...
@@ -4,8 +4,10 @@ from test import support
from
test.support
import
import_fresh_module
import
unittest
cET
=
import_fresh_module
(
'xml.etree.ElementTree'
,
fresh
=
[
'_elementtree'
])
cET_alias
=
import_fresh_module
(
'xml.etree.cElementTree'
,
fresh
=
[
'_elementtree'
,
'xml.etree'
])
cET
=
import_fresh_module
(
'xml.etree.ElementTree'
,
fresh
=
[
'_elementtree'
])
cET_alias
=
import_fresh_module
(
'xml.etree.cElementTree'
,
fresh
=
[
'_elementtree'
,
'xml.etree'
])
class
MiscTests
(
unittest
.
TestCase
):
...
...
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