From 7beae8a0d567022f959c70f0be367ced7af65808 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Thu, 6 Jan 2011 05:34:17 +0000 Subject: [PATCH] Issue 10825: Minor updates to the test suite. --- Lib/test/datetimetester.py | 2 +- Lib/test/test_httplib.py | 10 +++++----- Lib/test/test_threading.py | 4 ++-- Lib/test/test_winreg.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index dddf0f837d6..b5822ccf494 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -202,7 +202,7 @@ class TestTimeZone(unittest.TestCase): def test_dst(self): - self.assertEqual(None, timezone.utc.dst(self.DT)) + self.assertIsNone(timezone.utc.dst(self.DT)) with self.assertRaises(TypeError): self.EST.dst('') with self.assertRaises(TypeError): self.EST.dst(5) diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index fb80e7a35f9..890b1b9028c 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -560,7 +560,7 @@ class RequestBodyTest(TestCase): self.conn.request("PUT", "/url", "body") message, f = self.get_headers_and_fp() self.assertEqual("text/plain", message.get_content_type()) - self.assertEqual(None, message.get_charset()) + self.assertIsNone(message.get_charset()) self.assertEqual("4", message.get("content-length")) self.assertEqual(b'body', f.read()) @@ -568,7 +568,7 @@ class RequestBodyTest(TestCase): self.conn.request("PUT", "/url", "body\xc1") message, f = self.get_headers_and_fp() self.assertEqual("text/plain", message.get_content_type()) - self.assertEqual(None, message.get_charset()) + self.assertIsNone(message.get_charset()) self.assertEqual("5", message.get("content-length")) self.assertEqual(b'body\xc1', f.read()) @@ -576,7 +576,7 @@ class RequestBodyTest(TestCase): self.conn.request("PUT", "/url", b"body\xc1") message, f = self.get_headers_and_fp() self.assertEqual("text/plain", message.get_content_type()) - self.assertEqual(None, message.get_charset()) + self.assertIsNone(message.get_charset()) self.assertEqual("5", message.get("content-length")) self.assertEqual(b'body\xc1', f.read()) @@ -587,7 +587,7 @@ class RequestBodyTest(TestCase): self.conn.request("PUT", "/url", f) message, f = self.get_headers_and_fp() self.assertEqual("text/plain", message.get_content_type()) - self.assertEqual(None, message.get_charset()) + self.assertIsNone(message.get_charset()) self.assertEqual("4", message.get("content-length")) self.assertEqual(b'body', f.read()) @@ -598,7 +598,7 @@ class RequestBodyTest(TestCase): self.conn.request("PUT", "/url", f) message, f = self.get_headers_and_fp() self.assertEqual("text/plain", message.get_content_type()) - self.assertEqual(None, message.get_charset()) + self.assertIsNone(message.get_charset()) self.assertEqual("5", message.get("content-length")) self.assertEqual(b'body\xc1', f.read()) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 46d2f4723da..ecbbdbf56f6 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -396,7 +396,7 @@ class ThreadTests(BaseTestCase): weak_cyclic_object = weakref.ref(cyclic_object) cyclic_object.thread.join() del cyclic_object - self.assertEqual(None, weak_cyclic_object(), + self.assertIsNone(weak_cyclic_object(), msg=('%d references still around' % sys.getrefcount(weak_cyclic_object()))) @@ -404,7 +404,7 @@ class ThreadTests(BaseTestCase): weak_raising_cyclic_object = weakref.ref(raising_cyclic_object) raising_cyclic_object.thread.join() del raising_cyclic_object - self.assertEqual(None, weak_raising_cyclic_object(), + self.assertIsNone(weak_raising_cyclic_object(), msg=('%d references still around' % sys.getrefcount(weak_raising_cyclic_object()))) diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index b6b23c81fb9..0c1bf294631 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -341,8 +341,8 @@ class Win64WinregTests(BaseWinregTests): with OpenKey(HKEY_LOCAL_MACHINE, "Software") as key: # HKLM\Software is redirected but not reflected in all OSes self.assertTrue(QueryReflectionKey(key)) - self.assertEqual(None, EnableReflectionKey(key)) - self.assertEqual(None, DisableReflectionKey(key)) + self.assertIsNone(EnableReflectionKey(key)) + self.assertIsNone(DisableReflectionKey(key)) self.assertTrue(QueryReflectionKey(key)) @unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection")