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

Method test_trivial

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

Source from the content-addressed store, hash-verified

50 (k, module, v.__module__))
51
52 def test_trivial(self):
53 # A couple trivial tests
54
55 # clear _opener global variable
56 self.addCleanup(urllib.request.urlcleanup)
57
58 self.assertRaises(ValueError, urllib.request.urlopen, 'bogus url')
59
60 # XXX Name hacking to get this to work on Windows.
61 fname = os.path.abspath(urllib.request.__file__).replace(os.sep, '/')
62
63 if os.name == 'nt':
64 file_url = "file:///%s" % fname
65 else:
66 file_url = "file://%s" % fname
67
68 with urllib.request.urlopen(file_url) as f:
69 f.read()
70
71 def test_parse_http_list(self):
72 tests = [

Callers

nothing calls this directly

Calls 6

addCleanupMethod · 0.80
assertRaisesMethod · 0.45
replaceMethod · 0.45
abspathMethod · 0.45
urlopenMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected