def test_changeCacheSize(self):
        """
        Verify that changing the cache size results in a policy that
        respects the new cache size and not the default.

        """
        trustRoot = CustomOpenSSLTrustRoot()
        wrappedPolicy = BrowserLikePolicyForHTTPS(trustRoot=trustRoot)
        policy = HostnameCachingHTTPSPolicy(wrappedPolicy, cacheSize=5)
        for i in range(0, 5):
            hostname = u"host" + unicode(i)
            policy.creatorForNetloc(hostname.encode("ascii"), 8675)

        first = u"host0"
        self.assertIn(first, policy._cache)
        self.assertEquals(5, len(policy._cache))

        hostn = u"new"
        policy.creatorForNetloc(hostn.encode("ascii"), 309)
        self.assertNotIn(first, policy._cache)
        self.assertEquals(5, len(policy._cache))

        self.assertIn(hostn, policy._cache)

        Verify that changing the cache size results in a policy that
        respects the new cache size and not the default.

        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_agent.py