@@ -1544,7 +1544,7 @@ class DummyDataclass:
15441544 qux={'baz': 123, 'foo': 'bar'},
15451545 quux=['foo', 'bar', 'baz'],
15461546 corge=7,
1547- garply=(1, 2, 3, 4)
1547+ garply=(1, 2, 3, 4),
15481548)""" )
15491549
15501550 def test_expand_dict (self ):
@@ -1563,7 +1563,7 @@ def test_expand_dict(self):
15631563 'baz': 123,
15641564 'qux': {'foo': 'bar', 'baz': 123},
15651565 'quux': ['foo', 'bar', 'baz'],
1566- 'corge': 7
1566+ 'corge': 7,
15671567}""" )
15681568
15691569 def test_expand_ordered_dict (self ):
@@ -1580,7 +1580,7 @@ def test_expand_ordered_dict(self):
15801580 OrderedDict([
15811581 ('foo', 1),
15821582 ('bar', 12),
1583- ('baz', 123)
1583+ ('baz', 123),
15841584])""" )
15851585
15861586 def test_expand_list (self ):
@@ -1597,7 +1597,7 @@ def test_expand_list(self):
15971597 'foo',
15981598 'bar',
15991599 'baz',
1600- 'qux'
1600+ 'qux',
16011601]""" )
16021602
16031603 def test_expand_tuple (self ):
@@ -1618,7 +1618,15 @@ def test_expand_tuple(self):
16181618 'baz',
16191619 4,
16201620 5,
1621- 6
1621+ 6,
1622+ )""" )
1623+
1624+ def test_expand_single_element_tuple (self ):
1625+ self .assertEqual (
1626+ pprint .pformat ((1 ,), width = 1 , indent = 4 , expand = True ),
1627+ """\
1628+ (
1629+ 1,
16221630)""" )
16231631
16241632 def test_expand_set (self ):
@@ -1637,7 +1645,7 @@ def test_expand_set(self):
16371645 'baz',
16381646 'foo',
16391647 'qux',
1640- (1, 2, 3)
1648+ (1, 2, 3),
16411649}""" )
16421650
16431651 def test_expand_frozenset (self ):
@@ -1661,7 +1669,7 @@ def test_expand_frozenset(self):
16611669 'bar',
16621670 'baz',
16631671 'foo',
1664- (1, 2, 3)
1672+ (1, 2, 3),
16651673})""" )
16661674
16671675 def test_expand_frozendict (self ):
@@ -1674,7 +1682,7 @@ def test_expand_frozendict(self):
16741682 frozendict({
16751683 'baz': 123,
16761684 'foo': 'bar',
1677- 'qux': [1, 2]
1685+ 'qux': [1, 2],
16781686})""" ,
16791687 )
16801688
@@ -1717,7 +1725,7 @@ def test_expand_mappingproxy(self):
17171725 'corge': 7,
17181726 'foo': 'bar',
17191727 'quux': ['foo', 'bar', 'baz'],
1720- 'qux': {'baz': 123, 'foo': 'bar'}
1728+ 'qux': {'baz': 123, 'foo': 'bar'},
17211729})""" )
17221730
17231731 def test_expand_namespace (self ):
@@ -1740,8 +1748,8 @@ def test_expand_namespace(self):
17401748 baz=namespace(
17411749 x=321,
17421750 y='string',
1743- d={'bar': 'baz', 'foo': True}
1744- )
1751+ d={'bar': 'baz', 'foo': True},
1752+ ),
17451753)""" )
17461754
17471755 def test_expand_defaultdict (self ):
@@ -1755,7 +1763,7 @@ def test_expand_defaultdict(self):
17551763"""\
17561764 defaultdict(<class 'list'>, {
17571765 'bar': {'baz': None, 'foo': 'bar'},
1758- 'foo': ['bar', 'baz', 'qux']
1766+ 'foo': ['bar', 'baz', 'qux'],
17591767})""" )
17601768
17611769 def test_expand_counter (self ):
@@ -1766,7 +1774,7 @@ def test_expand_counter(self):
17661774 'b': 4,
17671775 'c': 3,
17681776 'd': 2,
1769- 'e': 1
1777+ 'e': 1,
17701778})"""
17711779 self .assertEqual (pprint .pformat (dummy_counter , width = 40 , indent = 4 ,
17721780 expand = True ), expected )
@@ -1777,7 +1785,7 @@ def test_expand_counter(self):
17771785 'b': 4,
17781786 'c': 3,
17791787 'd': 2,
1780- 'e': 1
1788+ 'e': 1,
17811789})"""
17821790 self .assertEqual (pprint .pformat (dummy_counter , width = 20 , indent = 2 ,
17831791 expand = True ), expected2 )
@@ -1810,11 +1818,11 @@ def test_expand_chainmap(self):
18101818 'quux': ['foo', 'bar', 'baz'],
18111819 'qux': {
18121820 'baz': 123,
1813- 'foo': 'bar'
1814- }
1815- }
1821+ 'foo': 'bar',
1822+ },
1823+ },
18161824 },
1817- {'garply': 'waldo'}
1825+ {'garply': 'waldo'},
18181826)""" )
18191827
18201828 def test_expand_deque (self ):
@@ -1851,11 +1859,11 @@ def test_expand_deque(self):
18511859 'corge': 7,
18521860 'foo': 'bar',
18531861 'quux': ['foo', 'bar', 'baz'],
1854- 'qux': {'baz': 123, 'foo': 'bar'}
1862+ 'qux': {'baz': 123, 'foo': 'bar'},
18551863 },
18561864 'foo',
18571865 'bar',
1858- 'baz'
1866+ 'baz',
18591867], maxlen=10)""" )
18601868
18611869 def test_expand_userdict (self ):
@@ -1879,7 +1887,7 @@ def __init__(self, *args, **kwargs):
18791887 'corge': 7,
18801888 'foo': 'bar',
18811889 'quux': ['foo', 'bar', 'baz'],
1882- 'qux': {'baz': 123, 'foo': 'bar'}
1890+ 'qux': {'baz': 123, 'foo': 'bar'},
18831891}""" )
18841892
18851893 def test_expand_userlist (self ):
@@ -1899,10 +1907,9 @@ def __init__(self, *args, **kwargs):
18991907 'first',
19001908 2,
19011909 {'key': 'value'},
1902- [4, 5, 6]
1910+ [4, 5, 6],
19031911]""" )
19041912
1905-
19061913 def test_expand_dict_keys (self ):
19071914 d = {"foo" : 1 , "bar" : 2 , "baz" : 3 , "qux" : 4 , "quux" : 5 }
19081915 self .assertEqual (
@@ -1913,7 +1920,7 @@ def test_expand_dict_keys(self):
19131920 'baz',
19141921 'foo',
19151922 'quux',
1916- 'qux'
1923+ 'qux',
19171924])""" ,
19181925 )
19191926
@@ -1927,7 +1934,7 @@ def test_expand_dict_values(self):
19271934 2,
19281935 3,
19291936 4,
1930- 5
1937+ 5,
19311938])""" ,
19321939 )
19331940
@@ -1941,7 +1948,7 @@ def test_expand_dict_items(self):
19411948 ('baz', 3),
19421949 ('foo', 1),
19431950 ('quux', 5),
1944- ('qux', 4)
1951+ ('qux', 4),
19451952])""" ,
19461953 )
19471954
0 commit comments