This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ygale
Recipients akuchling, ygale
Date 2008-02-24.14:06:49
SpamBayes Score 0.011879292
Marked as misclassified No
Message-id <1203862010.4.0.956181306486.issue1483@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-02-24 14:06:50ygalesetspambayes_score: 0.0118793 -> 0.011879292
recipients: + ygale, akuchling
2008-02-24 14:06:50ygalesetspambayes_score: 0.0118793 -> 0.0118793
messageid: <1203862010.4.0.956181306486.issue1483@psf.upfronthosting.co.za>
2008-02-24 14:06:49ygalelinkissue1483 messages
2008-02-24 14:06:49ygalecreate