Show More
@@ -791,7 +791,7 b' _singleton_pprinters = dict.fromkeys(map(id, [None, True, False, Ellipsis,' | |||||
791 |
|
791 | |||
792 |
|
792 | |||
793 | def _defaultdict_pprint(obj, p, cycle): |
|
793 | def _defaultdict_pprint(obj, p, cycle): | |
794 | name = 'defaultdict' |
|
794 | name = obj.__class__.__name__ | |
795 | with p.group(len(name) + 1, name + '(', ')'): |
|
795 | with p.group(len(name) + 1, name + '(', ')'): | |
796 | if cycle: |
|
796 | if cycle: | |
797 | p.text('...') |
|
797 | p.text('...') | |
@@ -802,7 +802,7 b' def _defaultdict_pprint(obj, p, cycle):' | |||||
802 | p.pretty(dict(obj)) |
|
802 | p.pretty(dict(obj)) | |
803 |
|
803 | |||
804 | def _ordereddict_pprint(obj, p, cycle): |
|
804 | def _ordereddict_pprint(obj, p, cycle): | |
805 | name = 'OrderedDict' |
|
805 | name = obj.__class__.__name__ | |
806 | with p.group(len(name) + 1, name + '(', ')'): |
|
806 | with p.group(len(name) + 1, name + '(', ')'): | |
807 | if cycle: |
|
807 | if cycle: | |
808 | p.text('...') |
|
808 | p.text('...') | |
@@ -810,7 +810,7 b' def _ordereddict_pprint(obj, p, cycle):' | |||||
810 | p.pretty(list(obj.items())) |
|
810 | p.pretty(list(obj.items())) | |
811 |
|
811 | |||
812 | def _deque_pprint(obj, p, cycle): |
|
812 | def _deque_pprint(obj, p, cycle): | |
813 | name = 'deque' |
|
813 | name = obj.__class__.__name__ | |
814 | with p.group(len(name) + 1, name + '(', ')'): |
|
814 | with p.group(len(name) + 1, name + '(', ')'): | |
815 | if cycle: |
|
815 | if cycle: | |
816 | p.text('...') |
|
816 | p.text('...') | |
@@ -819,7 +819,7 b' def _deque_pprint(obj, p, cycle):' | |||||
819 |
|
819 | |||
820 |
|
820 | |||
821 | def _counter_pprint(obj, p, cycle): |
|
821 | def _counter_pprint(obj, p, cycle): | |
822 | name = 'Counter' |
|
822 | name = obj.__class__.__name__ | |
823 | with p.group(len(name) + 1, name + '(', ')'): |
|
823 | with p.group(len(name) + 1, name + '(', ')'): | |
824 | if cycle: |
|
824 | if cycle: | |
825 | p.text('...') |
|
825 | p.text('...') |
@@ -350,9 +350,12 b' def test_collections_deque():' | |||||
350 | nt.assert_equal(pretty.pretty(obj), expected) |
|
350 | nt.assert_equal(pretty.pretty(obj), expected) | |
351 |
|
351 | |||
352 | def test_collections_counter(): |
|
352 | def test_collections_counter(): | |
|
353 | class MyCounter(Counter): | |||
|
354 | pass | |||
353 | cases = [ |
|
355 | cases = [ | |
354 | (Counter(), 'Counter()'), |
|
356 | (Counter(), 'Counter()'), | |
355 | (Counter(a=1), "Counter({'a': 1})"), |
|
357 | (Counter(a=1), "Counter({'a': 1})"), | |
|
358 | (MyCounter(a=1), "MyCounter({'a': 1})"), | |||
356 | ] |
|
359 | ] | |
357 | for obj, expected in cases: |
|
360 | for obj, expected in cases: | |
358 | nt.assert_equal(pretty.pretty(obj), expected) |
|
361 | nt.assert_equal(pretty.pretty(obj), expected) |
General Comments 0
You need to be logged in to leave comments.
Login now