twisted.python.test.test_sendmsg.BadList(list)
class documentationtwisted.python.test.test_sendmsg
(View In Hierarchy)
A list which cannot be iterated sometimes.
This is a list
subclass to get past the type check in
send1msg
, not as an example of how real programs might want to
interact with send1msg
(or anything else). A custom
list
subclass makes it easier to trigger certain error cases
in the implementation.
Instance Variable | iterate | A flag which indicates whether an instance of BadList
will allow iteration over itself or not. If False , an attempt
to iterate over the instance will raise an exception. |
Method | __iter__ | Allow normal list iteration, or raise an exception. |
BadList
will allow iteration over itself or not. If False
, an attempt
to iterate over the instance will raise an exception.
Allow normal list iteration, or raise an exception.
If self.iterate
is True
, it will be flipped to
False
and then normal iteration will proceed. If
self.iterate
is False
, RuntimeError
is raised instead.