File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ def __str__(self):
9797 return self .name
9898
9999 def __eq__ (self , other ):
100- return self .name == other .name and isinstance ( other , Font )
100+ return isinstance ( other , Font ) and self .name == other .name
101101
102102 def __getitem__ (self , key ):
103103 return self .cget (key )
Original file line number Diff line number Diff line change 1+ import unittest
2+ import tkinter
3+ from tkinter import font
4+ from test .support import requires , run_unittest
5+
6+ requires ('gui' )
7+
8+ class FontTest (unittest .TestCase ):
9+ def test_font_eq (self ):
10+ font1 = font .nametofont ("system" )
11+ font2 = font .nametofont ("system" )
12+ self .assertIsNot (font1 , font2 )
13+ self .assertEqual (font1 , font2 )
14+ self .assertNotEqual (font1 , font1 .copy ())
15+ self .assertNotEqual (font1 , 0 )
16+
17+ tests_gui = (FontTest , )
18+
19+ if __name__ == "__main__" :
20+ run_unittest (* tests_gui )
Original file line number Diff line number Diff line change @@ -52,6 +52,9 @@ Core and Builtins
5252Library
5353-------
5454
55+ - Issue #1730136: Fix the comparison between a tk.font.Font and an object of
56+ another kind.
57+
5558- Issue #9441: logging has better coverage for rotating file handlers.
5659
5760- Issue #9865: collections.OrderedDict now has a __sizeof__ method.
You can’t perform that action at this time.
0 commit comments