def test_changePassphraseBadKey(self):
        """
        L{changePassPhrase} exits if the file specified points to an invalid
        key.
        """
        filename = self.mktemp()
        FilePath(filename).setContent(b'foobar')
        error = self.assertRaises(
            SystemExit, changePassPhrase, {'filename': filename})

        if _PY3:
            expected = "Could not change passphrase: cannot guess the type of b'foobar'"
        else:
            expected = "Could not change passphrase: cannot guess the type of 'foobar'"
        self.assertEqual(expected, str(error))
        self.assertEqual(b'foobar', FilePath(filename).getContent())

        L{changePassPhrase} exits if the file specified points to an invalid
        key.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/test/test_ckeygen.py