cpython: 47016103185f (original) (raw)

Mercurial > cpython

changeset 75411:47016103185f

Issue #14007: accept incomplete TreeBuilder objects (missing start/end/data/close) for the Python implementation as well. Add disabled tests for the doctype() method. [#14007]

Florent Xicluna florent.xicluna@gmail.com
date Mon, 05 Mar 2012 10:42:19 +0100
parents 39cc025968f1
children cf7b360f9971
files Lib/test/test_xml_etree.py Lib/xml/etree/ElementTree.py Misc/NEWS
diffstat 3 files changed, 155 insertions(+), 95 deletions(-)[+] [-] Lib/test/test_xml_etree.py 165 Lib/xml/etree/ElementTree.py 81 Misc/NEWS 4

line wrap: on

line diff

--- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1855,58 +1855,16 @@ def check_issue10777():

--------------------------------------------------------------------

-class CleanContext(object):

-

+class ElementTreeTest(unittest.TestCase):

-

- - -class TestAcceleratorNotImported(unittest.TestCase):

- - -class TestElementClass(unittest.TestCase):

def test_Element_subclass_trivial(self): class MyElement(ET.Element): @@ -1936,16 +1894,115 @@ class TestElementClass(unittest.TestCase self.assertEqual(mye.newmethod(), 'joe') +class TreeBuilderTest(unittest.TestCase): +

+

+

+

+

+

+ +

+

+

+

+

+ + +class NoAcceleratorTest(unittest.TestCase): +

+ +# -------------------------------------------------------------------- + + +class CleanContext(object):

+

+

+

+ + def test_main(module=pyET): from test import test_xml_etree

- # The same doctests are used for both the Python and the C implementations test_xml_etree.ET = module

+

# XXX the C module should give the same warnings as the Python module with CleanContext(quiet=(module is not pyET)):

--- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1511,24 +1511,30 @@ class XMLParser: self.target = self._target = target self._error = expat.error self._names = {} # name memo cache

@@ -1572,44 +1578,29 @@ class XMLParser: attrib[fixname(attrib_in[i])] = attrib_in[i+1] return self.target.start(tag, attrib)

- def _end(self, tag): return self.target.end(self._fixname(tag))

-

- def _default(self, text): prefix = text[:1] if prefix == "&": # deal with undefined entities try:

@@ -1636,7 +1627,7 @@ class XMLParser: pubid = pubid[1:-1] if hasattr(self.target, "doctype"): self.target.doctype(name, pubid, system[1:-1])

@@ -1667,7 +1658,7 @@ class XMLParser: def feed(self, data): try:

@@ -1679,12 +1670,20 @@ class XMLParser: def close(self): try:

Import the C accelerators

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Core and Builtins Library ------- +- Issue #14007: Accept incomplete TreeBuilder objects (missing start, end,