summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-25 13:28:13 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-25 13:28:13 (GMT)
commitdde0815c359fc321b0e7a94f885132e2e77534a1 (patch)
tree4a21241e84b9b5427bb936f460269f1ff8bdcd83 /Lib/test/test_xml_etree.py
parent14128d8bc5e8f9e6f0234f47984fb7ca5167b082 (diff)
downloadcpython-dde0815c359fc321b0e7a94f885132e2e77534a1.zip
cpython-dde0815c359fc321b0e7a94f885132e2e77534a1.tar.gz
cpython-dde0815c359fc321b0e7a94f885132e2e77534a1.tar.bz2
Issue #7990: dir() on ElementTree.Element now lists properties: "tag",
"text", "tail" and "attrib". Original patch by Santoso Wijaya.
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 57d8e4d..0293201 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -182,10 +182,12 @@ class ElementTreeTest(unittest.TestCase):
def check_element(element):
self.assertTrue(ET.iselement(element), msg="not an element")
- self.assertTrue(hasattr(element, "tag"), msg="no tag member")
- self.assertTrue(hasattr(element, "attrib"), msg="no attrib member")
- self.assertTrue(hasattr(element, "text"), msg="no text member")
- self.assertTrue(hasattr(element, "tail"), msg="no tail member")
+ direlem = dir(element)
+ for attr in 'tag', 'attrib', 'text', 'tail':
+ self.assertTrue(hasattr(element, attr),
+ msg='no %s member' % attr)
+ self.assertIn(attr, direlem,
+ msg='no %s visible by dir' % attr)
check_string(element.tag)
check_mapping(element.attrib)