diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-06-11 21:38:39 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-06-11 21:38:39 (GMT) |
commit | 5de48bdd195b14426c772b4c61290aef7f33e3ec (patch) | |
tree | e4411088f62f76b183b18d543b4c4b64d4076d65 /Lib/test/test_pprint.py | |
parent | 80bfb725af0809308264d526ac6a024fc8386643 (diff) | |
download | cpython-5de48bdd195b14426c772b4c61290aef7f33e3ec.zip cpython-5de48bdd195b14426c772b4c61290aef7f33e3ec.tar.gz cpython-5de48bdd195b14426c772b4c61290aef7f33e3ec.tar.bz2 |
Simplify various spots where: str() is called on something
that already is a string or the existence of the str class
is checked or a check is done for str twice. These all stem
from the initial unicode->str replacement.
Diffstat (limited to 'Lib/test/test_pprint.py')
-rw-r--r-- | Lib/test/test_pprint.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index f7f6ac6..8698907 100644 --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -2,12 +2,6 @@ import pprint import test.test_support import unittest -try: - uni = str -except NameError: - def uni(x): - return x - # list, tuple and dict subclasses that do or don't overwrite __repr__ class list2(list): pass @@ -41,7 +35,7 @@ class QueryTestCase(unittest.TestCase): # Verify .isrecursive() and .isreadable() w/o recursion verify = self.assert_ pp = pprint.PrettyPrinter() - for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"), + for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, "yaddayadda", self.a, self.b): # module-level convenience functions verify(not pprint.isrecursive(safe), @@ -114,12 +108,12 @@ class QueryTestCase(unittest.TestCase): # multiple lines. For that reason, dicts with more than one element # aren't tested here. verify = self.assert_ - for simple in (0, 0, 0+0j, 0.0, "", uni(""), + for simple in (0, 0, 0+0j, 0.0, "", b"", (), tuple2(), tuple3(), [], list2(), list3(), {}, dict2(), dict3(), verify, pprint, - -6, -6, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6}, + -6, -6, -6-6j, -1.5, "x", b"x", (3,), [3], {3: 6}, (1,2), [3,4], {5: 6, 7: 8}, tuple2((1,2)), tuple3((1,2)), tuple3(range(100)), [3,4], list2([3,4]), list3([3,4]), list3(range(100)), |