def test_loseConnection(self):
        """
        Tesyt that loseConnection() doesn't close the channel until all
        the data is sent.
        """
        self.channel.write(b'data')
        self.channel.writeExtended(1, b'datadata')
        self.channel.loseConnection()
        self.assertIsNone(self.conn.closes.get(self.channel))
        self.channel.addWindowBytes(4) # send regular data
        self.assertIsNone(self.conn.closes.get(self.channel))
        self.channel.addWindowBytes(8) # send extended data
        self.assertTrue(self.conn.closes.get(self.channel))

        Tesyt that loseConnection() doesn't close the channel until all
        the data is sent.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_channel.py