Commit Graph

76 Commits

Author SHA1 Message Date
Eli Bendersky aaa9780fe1 Issue #9708: Fix support for iterparse(parser=...) argument per documentation.
When _elementtree is imported, iterparse is redefined as a class and the parser
argument was ommitted. Fix this, and add a docstring to the class.
2013-01-24 07:15:19 -08:00
Eli Bendersky a80f761a6d Add some tests for XPath numeric indexing 2013-01-22 06:12:54 -08:00
Eli Bendersky 25771b3749 Issue #16922: fixed findtext() to return empty Unicode string instead of empty bytes object when there's no text.
Patch by Serhiy Storchaka.
2013-01-13 05:26:07 -08:00
Eli Bendersky c31f77355c clean trailing whitespace 2013-01-12 07:44:32 -08:00
Eli Bendersky ceab1a950b Issues #15083 and #16992: port find.* method tests to unittest 2013-01-12 07:42:46 -08:00
Eli Bendersky e6174ca85e Issue #16913: Fix Element.itertext()'s handling of text with XML entities.
Patch by Serhiy Storchaka
2013-01-10 06:27:53 -08:00
Eli Bendersky 458c0d5a77 normalize whitespace 2013-01-10 06:07:00 -08:00
Eli Bendersky 698bdb2a6c Issue #16076: make _elementtree.Element pickle-able in a way that is compatible
with the Python version of the class.

Patch by Daniel Shahaf.
2013-01-10 06:01:06 -08:00
Eli Bendersky a873690d2c The get() and iter() are now able to accept keyword arguments.
In conformance with the documentation and the Python version.
Patch by Franck Michea.
2013-01-05 06:26:39 -08:00
Eli Bendersky 52280c427a Skip a test correctly for the C-version. The decorator doesn't really work
because it evaluates its condition before pyET is even set by test_main.
Therefore, the check it moved to "runtime".
2012-12-30 06:27:56 -08:00
Eli Bendersky 7ec45f7a36 For Issue #16076: make sure that pickling of Element objects is tested, and do
it properly to avoid problems with test-run-order dependencies.
2012-12-30 06:17:49 -08:00
Antoine Pitrou ee329318db Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). 2012-10-04 19:53:29 +02:00
Ezio Melotti ab9b661fdd #15970: merge with 3.2. 2012-09-19 08:25:01 +03:00
Ezio Melotti c90111f9ab #15970: xml.etree.ElementTree now serializes correctly the empty HTML elements "meta" and "param". 2012-09-19 08:19:12 +03:00
Eli Bendersky 426e248feb Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working 2012-07-17 05:45:11 +03:00
Eli Bendersky 00f402bfcb Close #1767933: Badly formed XML using etree and utf-16. Patch by Serhiy Storchaka, with some minor fixes by me 2012-07-15 06:02:22 +03:00
Eli Bendersky 6319e0fa20 Make the test more resilient to test-run order (closes #15075) 2012-06-16 06:47:44 +03:00
Eli Bendersky 307693a8bb Skip XincludeTest entirely instead of just ignoring failures, because it may segfault, depending on the order of running tests 2012-06-15 09:40:44 +03:00
Eli Bendersky 27cbb19ae5 Removed _SimpleElementPath and its flaky test. The test monkey-patches the module, which causes other failures and fails itself depending on the order tests are run. 2012-06-15 09:03:19 +03:00
Eli Bendersky 175fada429 mark problematic test as expected failure - investigating 2012-06-15 08:37:08 +03:00
Eli Bendersky 64d11e60f2 Replace the iter/itertext methods of Element in _elementtree with true C implementations, instead of the bootstrapped Python code. In addition to being cleaner (removing the last remains of the bootstrapping code in _elementtree), this gives a 10x performance boost for iter() on large documents.
Also reorganized the tests a bit to be more robust.
2012-06-15 07:42:50 +03:00
Eli Bendersky 2b6b73e7e1 Issue #14007: implement doctype() method calling in XMLParser of _elementtree.
Includes exposing a doctype handler from expat through pyexpat.
2012-06-01 11:32:34 +03:00
Eli Bendersky 52467b167e Issue #14007: make XMLParser a real subclassable type exported from _elementtree. +cleanups 2012-06-01 07:13:08 +03:00
Eli Bendersky 48d358ba86 Issue #14007: implemented the 'element_factory' feature of TreeBuilder in
_elementtree, with a test.
2012-05-30 17:57:50 +03:00
Eli Bendersky 58d548dff1 Issue #14007: make TreeBuilder an actual type exposed from _elementtree, and subclassable. 2012-05-29 15:45:16 +03:00
Eli Bendersky 737b173355 Issue 14814: Add namespaces keyword arg to find(*) methods in _elementtree.
Add attrib keyword to Element and SubElement in _elementtree.
Patch developed with Ezio Melotti.
2012-05-29 06:02:56 +03:00
Eli Bendersky b20df95827 Issue #14849: setup Element data members to be assignable in subclasses 2012-05-20 06:33:29 +03:00
Eli Bendersky ebf37a2ffb Fixes and enhancements to _elementtree:
* Fixed refleak problems when GC collection is run (see messages in
  issue #14065)
* Added weakref support to Element objects
2012-04-03 22:02:37 +03:00
Eli Bendersky 0261d754cd Removing the test of Element that causes ref-leak in GC (issue #14464).
I will now continue investigating the cause of the ref-leak, but I wanted
to remove the test so that the refcount test in the buildbots could be clean.
The whole change (adding GC to Element) is not reverted because it improved
the situation (GC works for immediate cycles) and didn't cause regressions
(the test is new and was added together with the fix).
2012-04-01 17:40:17 +03:00
Eli Bendersky a5e822045c Fix the tests of GC collection in ET.Element according to Benjamin's recommendations 2012-03-31 13:55:38 +03:00
Eli Bendersky 0192ba33b4 Issue #14065: Added cyclic GC support to ET.Element 2012-03-30 16:38:33 +03:00
Eli Bendersky 396e8fcf36 Issue #13782: streamline argument type-checking in ET.Element
append, extend and insert now consistently type-check their argument in both
the C and Python implementations, and raise TypeError for non-Element
argument.

Added tests
2012-03-23 14:24:20 +02:00
Eli Bendersky 6e33525098 fix trailing whitespace 2012-03-16 15:32:04 +02:00
Eli Bendersky 2b711409c7 Add a test that makes sure TreeBuilder can be passed element_factory in the
constructor. Marked as expectedFailure since it currently fails for the C
implementation.
2012-03-16 15:29:50 +02:00
Eli Bendersky 5b77d81314 Issue #14207: the ParseError exception raised by _elementtree was made
consistent to the one raised by the Python module (the 'code' attribute
was added).

In addition, the exception is now documented.

Added a test to check that ParseError has the required attributes, and
threw away the equivalent doctest which is no longer required.
2012-03-16 08:20:05 +02:00
Eli Bendersky f996e775ea Closes Issue #14246: _elementtree parser will now handle io.StringIO 2012-03-16 05:53:30 +02:00
Eli Bendersky 865756a94c Issue #14178: Problem deleting slices with steps != +1 in the _elementtree module.
Fixed the problem and added some tests. Closes #14178
2012-03-09 13:38:15 +02:00
Florent Xicluna 75b5e7ee15 Issue #14007: accept incomplete TreeBuilder objects (missing start/end/data/close) for the Python implementation as well. Add disabled tests for the doctype() method. 2012-03-05 10:42:19 +01:00
Eli Bendersky 092af1fc5c Issue #14128: Exposing Element as an actual type from _elementtree, rather than a factory function.
This makes the C implementation more aligned with the Python implementation.
Also added some tests to ensure that Element is now a type and that it can
be subclassed.
2012-03-04 07:14:03 +02:00
Florent Xicluna 1639505c38 fix the _namespace_map cleanup for cElementTree tests. 2012-02-16 23:28:35 +01:00
Florent Xicluna e59a306081 The C accelerator was not always imported for cElementTree's tests. (there's still an issue with --huntrleaks switch) 2012-02-16 23:17:31 +01:00
Eli Bendersky 292f9a891d make TestAccelerator[Not]Imported for ElementTree more robust 2012-02-16 19:55:29 +02:00
Eli Bendersky da57819efa in the tests of ElementTree, verify that the C accelerator is imported or not imported as expected 2012-02-16 06:52:39 +02:00
Florent Xicluna a72a98f24a Issue #13988: cElementTree is deprecated and the _elementtree accelerator is automatically used whenever available. 2012-02-13 11:03:30 +01:00
Florent Xicluna f24e7e6c41 Merge 3.2: issue #2892 2011-11-01 23:33:14 +01:00
Florent Xicluna 91d5193b3a Closes #2892: preserve iterparse events in case of SyntaxError. 2011-11-01 23:31:09 +01:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Marc-André Lemburg 8f36af7a4c Normalize the encoding names for Latin-1 and UTF-8 to
'latin-1' and 'utf-8'.

These are optimized in the Python Unicode implementation
to result in more direct processing, bypassing the codec
registry.

Also see issue11303.
2011-02-25 15:42:01 +00:00
Georg Brandl 90b20675bd #10777: fix iteration over dict keys while mutating the dict. 2010-12-28 10:38:33 +00:00
Senthil Kumaran ec30b3dd8c Fix Issue10205 - XML QName error when different tags have same QName. 2010-11-09 02:36:59 +00:00