[Python-Dev] Recent changes to TextIOWrapper and its tests (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Tue Mar 19 00:56:51 CET 2013
- Previous message: [Python-Dev] Recent changes to TextIOWrapper and its tests
- Next message: [Python-Dev] Recent changes to TextIOWrapper and its tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 18.03.13 22:26, Jeff Allen wrote:
The puzzle is that it requires t.read() to succeed.
When I insert a check for bytes type in all the places it seems necessary in my code, I pass the first two conditions, but since t.read() also raises TypeError, the overall test fails. Is reading the stream with read() intended to succeed? Why is this desired?
This is not desired. I just registered the current behavior. Python 3 is more strict and always raises an exception.
Perhaps this test should be relaxed. I.e. use
with self.maybeRaises(TypeError):
t.read()
and define maybeRaises() as:
@contextlib.contextmanager
def maybeRaises(self, *args, **kwds):
try:
yield
except args:
pass
- Previous message: [Python-Dev] Recent changes to TextIOWrapper and its tests
- Next message: [Python-Dev] Recent changes to TextIOWrapper and its tests
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]