diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-08 12:50:08 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-08 12:50:08 (GMT) |
commit | 25d8aeac7c1e24df79c18f6391b7e42b873d66d8 (patch) | |
tree | 3171eaac6be60dd8623e5d0ccab67adf38a44215 /Lib/test/test_urllib2net.py | |
parent | 3a20a5deade014a4559a71962600b23ee9f608f4 (diff) | |
download | cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.zip cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.tar.gz cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.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.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py index a4c1622..4981c24 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -85,7 +85,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) @@ -252,15 +252,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) @@ -272,7 +272,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) @@ -281,7 +281,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" @@ -293,14 +293,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: @@ -311,7 +311,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: @@ -319,7 +319,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): |