def test_requestPty(self):
        """
        When a client requests a PTY, the SSHSession object should make
        the request by getting an ISession adapter for the avatar, then
        calling getPty with the terminal type, the window size, and any modes
        the client gave us.
        """
        # 'bad' terminal type fails
        ret = self.session.requestReceived(
            b'pty_req',  session.packRequest_pty_req(
                b'bad', (1, 2, 3, 4), b''))
        self.assertFalse(ret)
        self.assertSessionIsStubSession()
        self.assertRequestRaisedRuntimeError()
        # 'good' terminal type succeeds
        self.assertTrue(self.session.requestReceived(b'pty_req',
            session.packRequest_pty_req(b'good', (1, 2, 3, 4), b'')))
        self.assertEqual(self.session.session.ptyRequest,
                (b'good', (1, 2, 3, 4), []))

        When a client requests a PTY, the SSHSession object should make
        the request by getting an ISession adapter for the avatar, then
        calling getPty with the terminal type, the window size, and any modes
        the client gave us.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_session.py