Skip to content

Commit 13186e3

Browse files
committed
Add the tests with root with attributes
1 parent 8aa94ac commit 13186e3

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/test_libcomxml.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,26 @@ def __init__(self):
190190
feed.build_tree()
191191

192192
self.assertEqual(self.xml, str(feed))
193+
194+
195+
class RootWithAttributes(unittest.TestCase):
196+
197+
def setUp(self):
198+
self.xml = "<?xml version='1.0' encoding='UTF-8'?>\n"
199+
self.xml += "<link href=\"http://example.com\"/>"
200+
201+
def test_root_with_attributes(self):
202+
203+
class Link(XmlModel):
204+
205+
_sort_order = ('tag', )
206+
207+
def __init__(self):
208+
self.tag = XmlField('link')
209+
super(Link, self).__init__('Link', 'tag', drop_empty=False)
210+
211+
l = Link()
212+
l.tag.attributes.update({'href': 'http://example.com'})
213+
l.build_tree()
214+
215+
self.assertEqual(self.xml, str(l))

0 commit comments

Comments
 (0)