Index: Lib/test/test_sax.py =================================================================== --- Lib/test/test_sax.py (revision 50855) +++ Lib/test/test_sax.py (working copy) @@ -670,7 +670,43 @@ attrs[(ns_uri, "attr")] == "val" and \ attrs.getQNameByName((ns_uri, "attr")) == "ns:attr" +import xml +if xml.__name__ == "xmlcore": + # + # Only the core implementation is available, and this may only + # apply in that case. Needs to be tested with Python 2.5 and + # PyXML still. + # + # This is specifically testing that the "xml" package is properly + # handled when the xmlcore package is used as the implementation. + def test_sf_1511497(): + # Bug report: http://www.python.org/sf/1511497 + import sys + old_modules = sys.modules.copy() + for modname in sys.modules.keys(): + if modname.startswith("xml.") or modname.startswith("xmlcore."): + del sys.modules[modname] + try: + import xml.sax.expatreader + module = xml.sax.expatreader + return module.__name__ == "xmlcore.sax.expatreader" + finally: + sys.modules.update(old_modules) + + def test_sf_1513611(): + # Bug report: http://www.python.org/sf/1513611 + sio = StringIO("invalid") + parser = make_parser() + from xml.sax import SAXParseException + try: + parser.parse(sio) + except SAXParseException: + return True + else: + return False + + # ===== Main program def make_test_output():