summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-08-08 05:42:54 (GMT)
committerGitHub <noreply@github.com>2019-08-08 05:42:54 (GMT)
commit662db125cddbca1db68116c547c290eb3943d98e (patch)
tree06151487dbe4493ef173dd8cc378f4b6cf5c0e4a /Lib/tkinter/test
parent4c69be22df3852f17873a74d015528d9a8ae92d6 (diff)
downloadcpython-662db125cddbca1db68116c547c290eb3943d98e.zip
cpython-662db125cddbca1db68116c547c290eb3943d98e.tar.gz
cpython-662db125cddbca1db68116c547c290eb3943d98e.tar.bz2
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_font.py3
-rw-r--r--Lib/tkinter/test/test_tkinter/test_variables.py13
2 files changed, 12 insertions, 4 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_font.py b/Lib/tkinter/test/test_tkinter/test_font.py
index 97cd87c..a021ea3 100644
--- a/Lib/tkinter/test/test_tkinter/test_font.py
+++ b/Lib/tkinter/test/test_tkinter/test_font.py
@@ -1,7 +1,7 @@
import unittest
import tkinter
from tkinter import font
-from test.support import requires, run_unittest, gc_collect
+from test.support import requires, run_unittest, gc_collect, ALWAYS_EQ
from tkinter.test.support import AbstractTkTest
requires('gui')
@@ -70,6 +70,7 @@ class FontTest(AbstractTkTest, unittest.TestCase):
self.assertEqual(font1, font2)
self.assertNotEqual(font1, font1.copy())
self.assertNotEqual(font1, 0)
+ self.assertEqual(font1, ALWAYS_EQ)
def test_measure(self):
self.assertIsInstance(self.font.measure('abc'), int)
diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py
index 2eb1e12..08b7ded 100644
--- a/Lib/tkinter/test/test_tkinter/test_variables.py
+++ b/Lib/tkinter/test/test_tkinter/test_variables.py
@@ -2,6 +2,7 @@ import unittest
import gc
from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl,
TclError)
+from test.support import ALWAYS_EQ
class Var(Variable):
@@ -59,11 +60,17 @@ class TestVariable(TestBase):
# values doesn't matter, only class and name are checked
v1 = Variable(self.root, name="abc")
v2 = Variable(self.root, name="abc")
+ self.assertIsNot(v1, v2)
self.assertEqual(v1, v2)
- v3 = Variable(self.root, name="abc")
- v4 = StringVar(self.root, name="abc")
- self.assertNotEqual(v3, v4)
+ v3 = StringVar(self.root, name="abc")
+ self.assertNotEqual(v1, v3)
+
+ V = type('Variable', (), {})
+ self.assertNotEqual(v1, V())
+
+ self.assertNotEqual(v1, object())
+ self.assertEqual(v1, ALWAYS_EQ)
def test_invalid_name(self):
with self.assertRaises(TypeError):