FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update `test_urllibnet.py` from 3.13.11 by ShaharNaveh · Pull Request #6432 · RustPython/RustPython · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 5 additions & 3 deletions Lib/test/test_urllibnet.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support.testcase import ExtraAssertions

import contextlib
import socket
Expand Down Expand Up @@ -34,7 +35,7 @@ def testURLread(self):
f.read()


class urlopenNetworkTests(unittest.TestCase):
class urlopenNetworkTests(unittest.TestCase, ExtraAssertions):
"""Tests urllib.request.urlopen using the network.

These tests are not exhaustive. Assuming that testing using files does a
Expand Down Expand Up @@ -70,8 +71,7 @@ def test_basic(self):
with self.urlopen(self.url) as open_url:
for attr in ("read", "readline", "readlines", "fileno", "close",
"info", "geturl"):
self.assertTrue(hasattr(open_url, attr), "object returned from "
"urlopen lacks the %s attribute" % attr)
self.assertHasAttr(open_url, attr)
self.assertTrue(open_url.read(), "calling 'read' failed")

def test_readlines(self):
Expand Down Expand Up @@ -109,6 +109,7 @@ def test_getcode(self):
open_url.close()
self.assertEqual(code, 404)

@support.requires_resource('walltime')
def test_bad_address(self):
# Make sure proper exception is raised when connecting to a bogus
# address.
Expand Down Expand Up @@ -191,6 +192,7 @@ def test_header(self):

logo = "http://www.pythontest.net/"

@support.requires_resource('walltime')
def test_data_header(self):
with self.urlretrieve(self.logo) as (file_location, fileheaders):
datevalue = fileheaders.get('Date')
Expand Down
Loading

Back | FazBrowse Home | New Git URL