From 5de48bdd195b14426c772b4c61290aef7f33e3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Mon, 11 Jun 2007 21:38:39 +0000 Subject: 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. --- Lib/test/test_pprint.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Lib/test/test_pprint.py') diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py index f7f6ac6fd9..869890714d 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)), -- cgit v1.2.1