Skip to content

Commit 1ea37c9

Browse files
committed
Fix test: override __repr__()
1 parent ac88b36 commit 1ea37c9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Doc/c-api/unicode.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ APIs:
574574
575575
* - ``#R``
576576
- :c:expr:`PyObject*`
577-
- Similar to ``R`` format, but don't call :meth:`~object.__str__`
577+
- Similar to ``R`` format, but don't call :meth:`~object.__repr__`
578578
method on :class:`str` subclasses.
579579
580580
* - ``T``

‎Lib/test/test_capi/test_unicode.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,11 @@ def check_format(expected, format, *args):
460460
check_format("'abc'",
461461
b'%#R', 'abc')
462462
class StrSubclass(str):
463-
def __str__(self):
463+
def __repr__(self):
464464
return 'StrSubclass'
465465
check_format("'abc'",
466466
b'%#R', StrSubclass('abc'))
467-
self.assertEqual(str(StrSubclass()), 'StrSubclass')
467+
self.assertEqual(repr(StrSubclass()), 'StrSubclass')
468468

469469
check_format('\u20acAB',
470470
b'%.3V', '\u20acABCDEF', None)

0 commit comments

Comments
 (0)