[lxml-dev] test failures, lxml-2.2
I am hoping that there's an easy fix. I couldn't find anything about it in the mailing list. Anyone know what the problem might be? Jorge root@a0110:/data3/lxml-2.2# uname -a Linux a0110 2.6.18-8.el5PAE #1 SMP Thu Mar 15 20:29:51 EDT 2007 i686 i686 i386 GNU/Linux root@a0110:/data3/lxml-2.2# make test python setup.py build_ext -i Building lxml version 2.2. Building with Cython 0.11. Using build configuration of libxslt 1.1.24 Building against libxml2/libxslt in the following directory: /usr/ local/lib running build_ext python test.py -p -v TESTED VERSION: 2.2.0 Python: (2, 5, 2, 'final', 0) lxml.etree: (2, 2, 0, 0) libxml used: (2, 7, 3) libxml compiled: (2, 7, 3) libxslt used: (1, 1, 24) libxslt compiled: (1, 1, 24) 1010/1010 (100.0%): Doctest: xpathxslt.txt ---------------------------------------------------------------------- Ran 1010 tests in 29.973s OK PYTHONPATH=src: python selftest.py ********************************************************************** File "/var/data3/lxml-2.2/selftest.py", line 575, in selftest.encoding Failed example: serialize(elem) Expected: '<tag key="åöö<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest.py", line 577, in selftest.encoding Failed example: serialize(elem, encoding="utf-8") Expected: '<tag key="\xc3\xa5\xc3\xb6\xc3\xb6<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest.py", line 579, in selftest.encoding Failed example: serialize(elem, encoding="us-ascii") Expected: '<tag key="åöö<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest.py", line 581, in selftest.encoding Failed example: serialize(elem, encoding="iso-8859-1").lower() Expected: '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="\xe5\xf6\xf6<>"/>' Got: '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="åöö<>"/>' ********************************************************************** 1 items had failures: 4 of 29 in selftest.encoding ***Test Failed*** 4 failures. 181 tests ok. PYTHONPATH=src: python selftest2.py ********************************************************************** File "/var/data3/lxml-2.2/selftest2.py", line 196, in selftest2.encoding Failed example: serialize(elem) Expected: '<tag key="åöö<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest2.py", line 198, in selftest2.encoding Failed example: serialize(elem, "utf-8") Expected: '<tag key="\xc3\xa5\xc3\xb6\xc3\xb6<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest2.py", line 200, in selftest2.encoding Failed example: serialize(elem, "us-ascii") Expected: '<tag key="åöö<>"/>' Got: '<tag key="åöö<>"/>' ********************************************************************** File "/var/data3/lxml-2.2/selftest2.py", line 202, in selftest2.encoding Failed example: serialize(elem, "iso-8859-1").lower() Expected: '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="\xe5\xf6\xf6<>"/>' Got: '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>\n<tag key="åöö<>"/>' ********************************************************************** 1 items had failures: 4 of 29 in selftest2.encoding ***Test Failed*** 4 failures. 102 tests ok. root@a0110:/data3/lxml-2.2#
В Чтв, 26/03/2009 в 09:45 -0700, Jorge Barrios пишет:
I am hoping that there's an easy fix. I couldn't find anything about it in the mailing list. Anyone know what the problem might be?
PYTHONPATH=src: python selftest.py ********************************************************************** File "/var/data3/lxml-2.2/selftest.py", line 575, in selftest.encoding Failed example: serialize(elem) Expected: '<tag key="åöö<>"/>' Got: '<tag key="åöö<>"/>' **********************************************************************
It doesn't look like a problem. It seems libxml serializes using hex representation of entities. The deserialized value would be the same. I don't know if libxml2 has a switch to turn old behaviour back, sorry. In [7]: etree.fromstring('<tag key="åöö<>"/>').attrib['key'] Out[7]: u'\xe5\xf6\xf6<>' In [8]: etree.fromstring('<tag key="åöö<>"/>').attrib['key'] Out[8]: u'\xe5\xf6\xf6<>' In [9]: k1 = etree.fromstring('<tag key="åöö<>"/>').attrib['key'] In [10]: k2 = etree.fromstring('<tag key="åöö<>"/>').attrib['key'] In [11]: k1 == k2 Out[11]: True
participants (2)
-
Alexander Shigin
-
Jorge Barrios