diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-26 06:43:21 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-26 06:43:21 (GMT) |
commit | f3fa308817a578c8809c70f6b24b1c489eeef803 (patch) | |
tree | 69098314e0b7896b62666b1a6e5fc81bb153846b /Lib/test/test_pprint.py | |
parent | e6bb7eb27b8b81ed74e5132628ca8e6415baf57e (diff) | |
download | cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.zip cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.tar.gz cpython-f3fa308817a578c8809c70f6b24b1c489eeef803.tar.bz2 |
Issue #23776: Removed asserts from pprint.PrettyPrinter constructor.
Diffstat (limited to 'Lib/test/test_pprint.py')
-rw-r--r-- | Lib/test/test_pprint.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index 3a798d9..01e19fe 100644 --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- +import collections +import io +import itertools import pprint +import random import test.support -import unittest import test.test_set -import random -import collections -import itertools import types +import unittest # list, tuple and dict subclasses that do or don't overwrite __repr__ class list2(list): @@ -56,6 +57,18 @@ class QueryTestCase(unittest.TestCase): self.b = list(range(200)) self.a[-12] = self.b + def test_init(self): + pp = pprint.PrettyPrinter() + pp = pprint.PrettyPrinter(indent=4, width=40, depth=5, + stream=io.StringIO(), compact=True) + pp = pprint.PrettyPrinter(4, 40, 5, io.StringIO()) + with self.assertRaises(TypeError): + pp = pprint.PrettyPrinter(4, 40, 5, io.StringIO(), True) + self.assertRaises(ValueError, pprint.PrettyPrinter, indent=-1) + self.assertRaises(ValueError, pprint.PrettyPrinter, depth=0) + self.assertRaises(ValueError, pprint.PrettyPrinter, depth=-1) + self.assertRaises(ValueError, pprint.PrettyPrinter, width=0) + def test_basic(self): # Verify .isrecursive() and .isreadable() w/o recursion pp = pprint.PrettyPrinter() |