def test_keyTooLong(self):
        """
        Verify that a key that is too long will immediately raise a synchronous
        exception.
        """
        c, s, p = connectedServerAndClient()
        x = "H" * (0xff+1)
        tl = self.assertRaises(amp.TooLong,
                               c.callRemoteString, b"Hello",
                               **{x: b"hi"})
        self.assertTrue(tl.isKey)
        self.assertTrue(tl.isLocal)
        self.assertIsNone(tl.keyName)
        self.assertEqual(tl.value, x.encode("ascii"))
        self.assertIn(str(len(x)), repr(tl))
        self.assertIn("key", repr(tl))

        Verify that a key that is too long will immediately raise a synchronous
        exception.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_amp.py