[Python-Dev] test_codecs failing

M.-A. Lemburg mal at egenix.com
Tue Feb 8 11:34:32 CET 2005


Walter Dörwald wrote:
> Raymond Hettinger wrote:
> 
>> The most recent test_codecs check-in (1.19) is failing on a MSCV6.0
>> compilation running on WinMe:
>>
>> ----------------------------------------------------------------------
>> Ran 35 tests in 1.430s
>>
>> FAILED (failures=1)
>> Traceback (most recent call last):
> 
>  > [...]
> 
>> test.test_support.TestFailed: Traceback (most recent call last):
>>   File "\py25\lib\test\test_codecs.py", line 165, in test_badbom
>>     self.assertRaises(UnicodeError, f.read)
>> AssertionError: UnicodeError not raised
> 
> 
> Fixed. But the question remains: Why does a StreamWriter have
> a read() method?

It inherits that method from the underlying stream - just as all
other methods and attributes that the stream defines and which
are not overridden by the StreamWriter methods. This approach was
taken to make it possible to user StreamWriter (and StreamReader)
instance as drop-in replacement in situations where the application
normally expects a file-like object.

Note that a file opened in write mode also exposes a read()
method.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 08 2005)
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Python-Dev mailing list