mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-94343: Ease initialization of reprlib.Repr attributes (GH-94581)
This commit is contained in:
parent
29f86d6c28
commit
b6558d768f
4 changed files with 60 additions and 14 deletions
|
@ -25,6 +25,28 @@ def nestedTuple(nesting):
|
|||
|
||||
class ReprTests(unittest.TestCase):
|
||||
|
||||
def test_init_kwargs(self):
|
||||
example_kwargs = {
|
||||
"maxlevel": 101,
|
||||
"maxtuple": 102,
|
||||
"maxlist": 103,
|
||||
"maxarray": 104,
|
||||
"maxdict": 105,
|
||||
"maxset": 106,
|
||||
"maxfrozenset": 107,
|
||||
"maxdeque": 108,
|
||||
"maxstring": 109,
|
||||
"maxlong": 110,
|
||||
"maxother": 111,
|
||||
"fillvalue": "x" * 112,
|
||||
}
|
||||
r1 = Repr()
|
||||
for attr, val in example_kwargs.items():
|
||||
setattr(r1, attr, val)
|
||||
r2 = Repr(**example_kwargs)
|
||||
for attr in example_kwargs:
|
||||
self.assertEqual(getattr(r1, attr), getattr(r2, attr), msg=attr)
|
||||
|
||||
def test_string(self):
|
||||
eq = self.assertEqual
|
||||
eq(r("abc"), "'abc'")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue