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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com