mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
This commit is contained in:
parent
ade2c216e1
commit
c161cb9955
3 changed files with 16 additions and 1 deletions
|
@ -10,6 +10,7 @@ import unittest
|
|||
|
||||
from test.test_support import run_unittest
|
||||
from repr import repr as r # Don't shadow builtin repr
|
||||
from repr import Repr
|
||||
|
||||
|
||||
def nestedTuple(nesting):
|
||||
|
@ -34,6 +35,18 @@ class ReprTests(unittest.TestCase):
|
|||
expected = repr(s)[:13] + "..." + repr(s)[-14:]
|
||||
eq(r(s), expected)
|
||||
|
||||
def test_tuple(self):
|
||||
eq = self.assertEquals
|
||||
eq(r((1,)), "(1,)")
|
||||
|
||||
t3 = (1, 2, 3)
|
||||
eq(r(t3), "(1, 2, 3)")
|
||||
|
||||
r2 = Repr()
|
||||
r2.maxtuple = 2
|
||||
expected = repr(t3)[:-2] + "...)"
|
||||
eq(r2.repr(t3), expected)
|
||||
|
||||
def test_container(self):
|
||||
from array import array
|
||||
from collections import deque
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue