Lines Matching refs:self

21     def setUp(self):
24 def tearDown(self):
27 def testURLread(self):
29 self.addCleanup(urllib.request.urlcleanup)
54 def setUp(self):
56 self.addCleanup(urllib.request.urlcleanup)
59 def urlopen(self, *args, **kwargs):
68 def test_basic(self):
70 with self.urlopen(self.url) as open_url:
73 self.assertTrue(hasattr(open_url, attr), "object returned from "
75 self.assertTrue(open_url.read(), "calling 'read' failed")
77 def test_readlines(self):
79 with self.urlopen(self.url) as open_url:
80 self.assertIsInstance(open_url.readline(), bytes,
82 self.assertIsInstance(open_url.readlines(), list,
85 def test_info(self):
87 with self.urlopen(self.url) as open_url:
89 self.assertIsInstance(info_obj, email.message.Message,
92 self.assertEqual(info_obj.get_content_subtype(), "html")
94 def test_geturl(self):
96 with self.urlopen(self.url) as open_url:
98 self.assertEqual(gotten_url, self.url)
100 def test_getcode(self):
102 URL = self.url + "XXXinvalidXXX"
104 with self.assertWarns(DeprecationWarning):
110 self.assertEqual(code, 404)
112 def test_bad_address(self):
143 self.skipTest("%r should not resolve for test to work" % bogus_domain)
147 with self.assertRaises(OSError, msg=failure_explanation):
154 def setUp(self):
156 self.addCleanup(urllib.request.urlcleanup)
159 def urlretrieve(self, *args, **kwargs):
168 def test_basic(self):
170 with self.urlretrieve(self.logo) as (file_location, info):
171 self.assertTrue(os.path.exists(file_location), "file location returned by"
174 self.assertTrue(f.read(), "reading from the file location returned"
177 def test_specified_path(self):
179 with self.urlretrieve(self.logo,
181 self.assertEqual(file_location, os_helper.TESTFN)
182 self.assertTrue(os.path.exists(file_location))
184 self.assertTrue(f.read(), "reading from temporary file failed")
186 def test_header(self):
188 with self.urlretrieve(self.logo) as (file_location, info):
189 self.assertIsInstance(info, email.message.Message,
194 def test_data_header(self):
195 with self.urlretrieve(self.logo) as (file_location, fileheaders):
201 self.fail('Date value not in %r format' % dateformat)
203 def test_reporthook(self):
209 with self.urlretrieve(self.logo, reporthook=recording_reporthook) as (
214 self.assertGreater(len(records), 1, msg="There should always be two "
216 self.assertEqual(records[0][0], 0)
217 self.assertGreater(records[0][1], 0,
219 self.assertEqual(records[0][2], expected_size)
220 self.assertEqual(records[-1][2], expected_size)
223 self.assertEqual({records[0][1]}, block_sizes,
225 self.assertGreaterEqual(records[-1][0]*records[0][1], expected_size,