diff options
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_font.py | 3 | ||||
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_variables.py | 13 |
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): |