summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/test_tkinter/test_font.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-12-29 10:56:55 (GMT)
committerGitHub <noreply@github.com>2020-12-29 10:56:55 (GMT)
commit1df56bc0597a051c13d53514e120e9b6764185f8 (patch)
treec3dfca8059205e1a4d6193097f4066b27f794154 /Lib/tkinter/test/test_tkinter/test_font.py
parent156b7f7052102ee1633a18e9a136ad8c38f66db0 (diff)
downloadcpython-1df56bc0597a051c13d53514e120e9b6764185f8.zip
cpython-1df56bc0597a051c13d53514e120e9b6764185f8.tar.gz
cpython-1df56bc0597a051c13d53514e120e9b6764185f8.tar.bz2
bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968)
Objects which belong to different Tcl interpreters are now always different, even if they have the same name.
Diffstat (limited to 'Lib/tkinter/test/test_tkinter/test_font.py')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_font.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_font.py b/Lib/tkinter/test/test_tkinter/test_font.py
index 0354c5f..91f9974 100644
--- a/Lib/tkinter/test/test_tkinter/test_font.py
+++ b/Lib/tkinter/test/test_tkinter/test_font.py
@@ -63,15 +63,22 @@ class FontTest(AbstractTkTest, unittest.TestCase):
self.assertEqual(self.font.name, fontname)
self.assertEqual(str(self.font), fontname)
- def test_eq(self):
+ def test_equality(self):
font1 = font.Font(root=self.root, name=fontname, exists=True)
font2 = font.Font(root=self.root, name=fontname, exists=True)
self.assertIsNot(font1, font2)
self.assertEqual(font1, font2)
self.assertNotEqual(font1, font1.copy())
+
self.assertNotEqual(font1, 0)
self.assertEqual(font1, ALWAYS_EQ)
+ root2 = tkinter.Tk()
+ self.addCleanup(root2.destroy)
+ font3 = font.Font(root=root2, name=fontname, exists=True)
+ self.assertEqual(str(font1), str(font3))
+ self.assertNotEqual(font1, font3)
+
def test_measure(self):
self.assertIsInstance(self.font.measure('abc'), int)