[py-svn] commit/py: RonnyPfannschmidt: propperly handle lists in xmlgen on python3

Bitbucket commits-noreply at bitbucket.org
Mon Dec 12 13:11:34 CET 2011


1 new commit in py:


https://bitbucket.org/hpk42/py/changeset/117ea069b045/
changeset:   117ea069b045
user:        RonnyPfannschmidt
date:        2011-12-12 13:11:02
summary:     propperly handle lists in xmlgen on python3
affected #:  3 files

diff -r 2366418b7ccc912749fc7ccb759cc057c55959ca -r 117ea069b0458e10e61dabb84aa8f85cd9d701f5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@
   about the eval magic of a decorator library
 - add py.builtin.next
 - iniconfig: add support for ; as comment starter
+- properly handle lists in xmlgen on python3
 
 Changes between 1.4.4 and 1.4.5
 ==================================================


diff -r 2366418b7ccc912749fc7ccb759cc057c55959ca -r 117ea069b0458e10e61dabb84aa8f85cd9d701f5 py/_xmlgen.py
--- a/py/_xmlgen.py
+++ b/py/_xmlgen.py
@@ -136,7 +136,8 @@
     def list(self, obj):
         assert id(obj) not in self.visited
         self.visited[id(obj)] = 1
-        map(self.visit, obj)
+        for elem in obj:
+            self.visit(elem)
 
     def Tag(self, tag):
         assert id(tag) not in self.visited


diff -r 2366418b7ccc912749fc7ccb759cc057c55959ca -r 117ea069b0458e10e61dabb84aa8f85cd9d701f5 testing/root/test_xmlgen.py
--- a/testing/root/test_xmlgen.py
+++ b/testing/root/test_xmlgen.py
@@ -54,6 +54,11 @@
     u = unicode(x)
     assert u == '<hello><world/></hello>'
 
+def test_list_nested():
+    x = ns.hello([ns.world()]) #pass in a list here
+    u = unicode(x)
+    assert u == '<hello><world/></hello>'
+
 def test_tag_xmlname():
     class my(ns.hello):
         xmlname = 'world'

Repository URL: https://bitbucket.org/hpk42/py/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list