Ejemplo n.º 1
0
 def test_enter_after_cancel(self):
     # There are no writes to chan2, so handshake should never complete
     chan1, chan2 = make_channel_pair()
     conn = Connection(chan1)
     conn.cancel()
     with self.assertRaises(ValueError):
         conn.__enter__()
Ejemplo n.º 2
0
 def test_enter_when_connect_fails(self):
     conn = Connection(UnconnectableChannel())
     with self.assertRaises(ConnectError):
         conn.__enter__()
     with self.assertRaisesRegex(ValueError, 'Connection is closed'):
         conn.__enter__()