summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2net.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-08 12:51:10 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-08 12:51:10 (GMT)
commitd3e1207191dcb84a58706a5101177f36c09c5681 (patch)
treedd8bafcf64e4b1fa8bdf65f21f44a2d04fc89861 /Lib/test/test_urllib2net.py
parent6c9678e1a5651bbaa2bfa31d564f2117033fd494 (diff)
parent25d8aeac7c1e24df79c18f6391b7e42b873d66d8 (diff)
downloadcpython-d3e1207191dcb84a58706a5101177f36c09c5681.zip
cpython-d3e1207191dcb84a58706a5101177f36c09c5681.tar.gz
cpython-d3e1207191dcb84a58706a5101177f36c09c5681.tar.bz2
Issue #20555: Use specific asserts in urllib, httplib, ftplib, cgi, wsgiref tests.
Diffstat (limited to 'Lib/test/test_urllib2net.py')
-rw-r--r--Lib/test/test_urllib2net.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index 21ce3ab..78891fd 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -87,7 +87,7 @@ class CloseSocketTest(unittest.TestCase):
with support.transient_internet(url):
response = _urlopen_with_retry(url)
sock = response.fp
- self.assertTrue(not sock.closed)
+ self.assertFalse(sock.closed)
response.close()
self.assertTrue(sock.closed)
@@ -262,15 +262,15 @@ class OtherNetworkTests(unittest.TestCase):
class TimeoutTest(unittest.TestCase):
def test_http_basic(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
url = "http://www.python.org"
with support.transient_internet(url, timeout=None):
u = _urlopen_with_retry(url)
self.addCleanup(u.close)
- self.assertTrue(u.fp.raw._sock.gettimeout() is None)
+ self.assertIsNone(u.fp.raw._sock.gettimeout())
def test_http_default_timeout(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
url = "http://www.python.org"
with support.transient_internet(url):
socket.setdefaulttimeout(60)
@@ -282,7 +282,7 @@ class TimeoutTest(unittest.TestCase):
self.assertEqual(u.fp.raw._sock.gettimeout(), 60)
def test_http_no_timeout(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
url = "http://www.python.org"
with support.transient_internet(url):
socket.setdefaulttimeout(60)
@@ -291,7 +291,7 @@ class TimeoutTest(unittest.TestCase):
self.addCleanup(u.close)
finally:
socket.setdefaulttimeout(None)
- self.assertTrue(u.fp.raw._sock.gettimeout() is None)
+ self.assertIsNone(u.fp.raw._sock.gettimeout())
def test_http_timeout(self):
url = "http://www.python.org"
@@ -303,14 +303,14 @@ class TimeoutTest(unittest.TestCase):
FTP_HOST = "ftp://ftp.mirror.nl/pub/gnu/"
def test_ftp_basic(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
with support.transient_internet(self.FTP_HOST, timeout=None):
u = _urlopen_with_retry(self.FTP_HOST)
self.addCleanup(u.close)
- self.assertTrue(u.fp.fp.raw._sock.gettimeout() is None)
+ self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
def test_ftp_default_timeout(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
with support.transient_internet(self.FTP_HOST):
socket.setdefaulttimeout(60)
try:
@@ -321,7 +321,7 @@ class TimeoutTest(unittest.TestCase):
self.assertEqual(u.fp.fp.raw._sock.gettimeout(), 60)
def test_ftp_no_timeout(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
with support.transient_internet(self.FTP_HOST):
socket.setdefaulttimeout(60)
try:
@@ -329,7 +329,7 @@ class TimeoutTest(unittest.TestCase):
self.addCleanup(u.close)
finally:
socket.setdefaulttimeout(None)
- self.assertTrue(u.fp.fp.raw._sock.gettimeout() is None)
+ self.assertIsNone(u.fp.fp.raw._sock.gettimeout())
def test_ftp_timeout(self):
with support.transient_internet(self.FTP_HOST):