MCPcopy Index your code
hub / github.com/python/cpython / test_proxy_no_proxy

Method test_proxy_no_proxy

Lib/test/test_urllib2.py:1465–1478  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1463 [tup[0:2] for tup in o.calls])
1464
1465 def test_proxy_no_proxy(self):
1466 env = self.enterContext(os_helper.EnvironmentVarGuard())
1467 env['no_proxy'] = 'python.org'
1468 o = OpenerDirector()
1469 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com"))
1470 o.add_handler(ph)
1471 req = Request("http://www.perl.org/")
1472 self.assertEqual(req.host, "www.perl.org")
1473 o.open(req)
1474 self.assertEqual(req.host, "proxy.example.com")
1475 req = Request("http://www.python.org")
1476 self.assertEqual(req.host, "www.python.org")
1477 o.open(req)
1478 self.assertEqual(req.host, "www.python.org")
1479
1480 def test_proxy_no_proxy_all(self):
1481 env = self.enterContext(os_helper.EnvironmentVarGuard())

Callers

nothing calls this directly

Calls 6

add_handlerMethod · 0.95
openMethod · 0.95
OpenerDirectorClass · 0.90
RequestClass · 0.90
enterContextMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected