[3.10] bpo-45060: Get rid of few uses of the equality operators with None (GH-28087). (GH-28092)
(cherry picked from commit 3c65457156d87e55010507d616b4eecb7a02883d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 316cf0b..6414f1a 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -344,7 +344,7 @@ def test_comparison(self):
with self.assertRaises(TypeError): timezone(ZERO) < timezone(ZERO)
self.assertIn(timezone(ZERO), {timezone(ZERO)})
self.assertTrue(timezone(ZERO) != None)
- self.assertFalse(timezone(ZERO) == None)
+ self.assertFalse(timezone(ZERO) == None)
tz = timezone(ZERO)
self.assertTrue(tz == ALWAYS_EQ)
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index e2e9475..0c17812 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -136,7 +136,7 @@ def test_openpty(self):
mode = None
new_stdin_winsz = None
- if self.stdin_rows != None and self.stdin_cols != None:
+ if self.stdin_rows is not None and self.stdin_cols is not None:
try:
# Modify pty.STDIN_FILENO window size; we need to
# check if pty.openpty() is able to set pty slave
diff --git a/Lib/test/test_type_annotations.py b/Lib/test/test_type_annotations.py
index f6c99bd..87f46c2c 100644
--- a/Lib/test/test_type_annotations.py
+++ b/Lib/test/test_type_annotations.py
@@ -71,7 +71,7 @@ def __annotations__(self, value):
@__annotations__.deleter
def __annotations__(self):
- if hasattr(self, 'my_annotations') and self.my_annotations == None:
+ if getattr(self, 'my_annotations', False) is None:
raise AttributeError('__annotations__')
self.my_annotations = None