def testAddingBadProtos_TooSmall(self):
"""Adding a protocol with a negative number raises an exception."""
e = rawudp.RawUDPProtocol()
try:
e.addProto(-1, protocol.DatagramProtocol())
except TypeError as e:
if e.args == ('Added protocol must be positive or zero',):
pass
else:
raise
else:
raise AssertionError('addProto must raise an exception for bad protocols')
评论列表
文章目录