def test_sslChainFileMustContainCert(self):
        """
        If C{extraCertChain} is passed, it has to contain at least one valid
        certificate in PEM format.
        """
        fp = FilePath(self.mktemp())
        fp.create().close()
        # The endpoint string is the same as in the valid case except for
        # a different chain file.  We use an empty temp file which obviously
        # will never contain any certificates.
        with self.assertRaises(ValueError) as caught:
            endpoints.serverFromString(
                object(),
                self.SSL_CHAIN_TEMPLATE % (
                    escapedPEMPathName,
                    endpoints.quoteStringArgument(fp.path),
                )
            )

        # The raised exception should list what file it is attempting to find
        # the chain in.
        self.assertEqual(str(caught.exception),
                         ("Specified chain file '%s' doesn't contain any valid"
                          " certificates in PEM format.") % (fp.path,))

        If C{extraCertChain} is passed, it has to contain at least one valid
        certificate in PEM format.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_endpoints.py