MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_proxy_no_proxy

Method test_proxy_no_proxy

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

Source from the content-addressed store, hash-verified

1446 [tup[0:2] for tup in o.calls])
1447
1448 def test_proxy_no_proxy(self):
1449 env = self.enterContext(os_helper.EnvironmentVarGuard())
1450 env['no_proxy'] = 'python.org'
1451 o = OpenerDirector()
1452 ph = urllib.request.ProxyHandler(dict(http="proxy.example.com"))
1453 o.add_handler(ph)
1454 req = Request("http://www.perl.org/")
1455 self.assertEqual(req.host, "www.perl.org")
1456 o.open(req)
1457 self.assertEqual(req.host, "proxy.example.com")
1458 req = Request("http://www.python.org")
1459 self.assertEqual(req.host, "www.python.org")
1460 o.open(req)
1461 self.assertEqual(req.host, "www.python.org")
1462
1463 def test_proxy_no_proxy_all(self):
1464 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