[lxml-dev] objectify factories
Stefan Behnel
stefan_ml at behnel.de
Fri Aug 31 21:36:39 CEST 2007
Hi Holger,
the trunk now builds with Cython instead of Pyrex, so please install it to get
rid of the one failing doctest. (the reason the test fails is that Cython
knows about the package you specify in distutils, Pyrex ignores it).
http://www.cython.org/
lxml requires Cython 0.9.6.5.
jholg at gmx.de wrote:
> Patch attached:
> - makes DataElement() behaviour consistent with new _setElementValue workings, using _typename(<value>) as pytype name, if not explicitly given
ok.
> - makes objectify ElementMaker add pytype annotation
ok. I modified the patch, mainly for performance reasons.
> - fixes _setElementValue() to safely delAttributeFromNsName() for unregistered types
Ah, thanks for testing :)
> - adds some tests for that stuff
Great, thanks.
> ======================================================================
> FAIL: Doctest: objectify.txt
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/apps/prod//lib/python2.4/unittest.py", line 260, in run
> testMethod()
> File "/apps/prod//lib/python2.4/doctest.py", line 2157, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for objectify.txt
> File "/data/pydev/hjoukl/LXML/lxml/src/lxml/tests/../../../doc/objectify.txt", line 0
>
> ----------------------------------------------------------------------
> File "/data/pydev/hjoukl/LXML/lxml/src/lxml/tests/../../../doc/objectify.txt", line 283, in objectify.txt
> Failed example:
> print etree.tostring(root, pretty_print=True)
> Expected:
> <root>
> <a>5</a>
> <b>6.1</b>
> <c>true</c>
> <d tell="me">how</d>
> </root>
> Got:
> <root xmlns:ns0="http://codespeak.net/lxml/objectify/pytype" ns0:pytype="TREE">
> <a xmlns:ns0="http://codespeak.net/lxml/objectify/pytype" ns0:pytype="int">5</a>
> <b ns0:pytype="float">6.1</b>
> <c ns0:pytype="bool">true</c>
> <d tell="me" ns0:pytype="str">how</d>
> </root>
:) _DEFAULT_NSMAP is only set *after* the instantiation of the E factory, so
its None value is copied into the instance.
Stefan
More information about the lxml-dev
mailing list