8000 bpo-41876: Overload __repr__ for tkinter Font objects by platonoff-dev · Pull Request #22450 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41876: Overload __repr__ for tkinter Font objects #22450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 14, 2020
Prev Previous commit
Next Next commit
Fix too long lines folowing PEP-8
  • Loading branch information
platonoff-dev committed Sep 29, 2020
commit e954c2f3cf373f310a86be948b0aea8f1c89b2b4
3 changes: 2 additions & 1 deletion Lib/tkinter/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def __str__(self):
return self.name

def __repr__(self):
return f"<{self.__class__.__module__}.{self.__class__.__qualname__} object {self.name!r}>"
return f"<{self.__class__.__module__}.{self.__class__.__qualname__}" \
f" object {self.name!r}>"

def __eq__(self, other):
if not isinstance(other, Font):
Expand Down
9028
4 changes: 3 additions & 1 deletion Lib/tkinter/test/test_tkinter/test_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def test_names(self):
self.assertIn(fontname, names)

def test_repr(self):
self.assertEqual(repr(self.font), f'<{self.font.__class__.__module__}.{self.font.__class__.__qualname__} object {fontname!r}>')
self.assertEqual(
repr(self.font), f'<tkinter.font.Font object {fontname!r}>'
)


tests_gui = (FontTest, )
Expand Down
0