diff options
author | Lance Stout <lancestout@gmail.com> | 2012-02-19 20:27:19 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-02-19 20:27:19 -0800 |
commit | c36073b40e2caef337511fa3a4e386dce5449bd2 (patch) | |
tree | b8a8373fda58dbeea29e3d3d357e839b77e26efd /sleekxmpp/test | |
parent | afe0d16797db0d895c8779d378cb9ca1a6a7f39c (diff) | |
download | slixmpp-c36073b40e2caef337511fa3a4e386dce5449bd2.tar.gz slixmpp-c36073b40e2caef337511fa3a4e386dce5449bd2.tar.bz2 slixmpp-c36073b40e2caef337511fa3a4e386dce5449bd2.tar.xz slixmpp-c36073b40e2caef337511fa3a4e386dce5449bd2.zip |
xml.etree.ElementTree raises ExpatError instead of SyntaxError or ParseError.
Diffstat (limited to 'sleekxmpp/test')
-rw-r--r-- | sleekxmpp/test/sleektest.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py index dd3df29a..364e5939 100644 --- a/sleekxmpp/test/sleektest.py +++ b/sleekxmpp/test/sleektest.py @@ -7,6 +7,7 @@ """ import unittest +from xml.parsers.expat import ExpatError try: import Queue as queue except: @@ -62,8 +63,9 @@ class SleekTest(unittest.TestCase): try: xml = ET.fromstring(xml_string) return xml - except SyntaxError as e: - if 'unbound' in e.msg: + except (SyntaxError, ExpatError) as e: + msg = e.msg if hasattr(e, 'msg') else e.message + if 'unbound' in msg: known_prefixes = { 'stream': 'http://etherx.jabber.org/streams'} |