Yitz Gale added the comment: Sure. Here is a simple test case:
def testUseCharacterStream(self): '''If the source is an InputSource with a character stream, use it.''' src = xml.sax.xmlreader.InputSource(temp_file_name) src.setCharacterStream(StringIO.StringIO(u"foo")) prep = xml.sax.saxutils.prepare_input_source(src) self.failIf(prep.getCharacterStream() is None, "ignored character stream") If "temp_file_name" is omitted, you'll get an AttributeError, and if you put it in but the file doesn't exist, you'll get an IOError. I'm attaching an almost full set of tests. It omits the case of a URL. You can easily put that in if you have a handy function that converts a file path to a file URL, with all the fidgety stuff you need for Windows. (Does that already exist somewhere?) Unfortunately, I now see that the problem is a bit deeper than this. There are two more related bugs that need to be fixed before this really works. See #2174 and #2175. Added file: http://bugs.python.org/file9536/test_prepare_input_source.py __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1483> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com