(self)
| 174 | pprint.PrettyPrinter().pprint(value) |
| 175 | |
| 176 | def test_knotted(self): |
| 177 | # Verify .isrecursive() and .isreadable() w/ recursion |
| 178 | # Tie a knot. |
| 179 | self.b[67] = self.a |
| 180 | # Messy dict. |
| 181 | self.d = {} |
| 182 | self.d[0] = self.d[1] = self.d[2] = self.d |
| 183 | |
| 184 | pp = pprint.PrettyPrinter() |
| 185 | |
| 186 | for icky in self.a, self.b, self.d, (self.d, self.d): |
| 187 | self.assertTrue(pprint.isrecursive(icky), "expected isrecursive") |
| 188 | self.assertFalse(pprint.isreadable(icky), "expected not isreadable") |
| 189 | self.assertTrue(pp.isrecursive(icky), "expected isrecursive") |
| 190 | self.assertFalse(pp.isreadable(icky), "expected not isreadable") |
| 191 | |
| 192 | # Break the cycles. |
| 193 | self.d.clear() |
| 194 | del self.a[:] |
| 195 | del self.b[:] |
| 196 | |
| 197 | for safe in self.a, self.b, self.d, (self.d, self.d): |
| 198 | # module-level convenience functions |
| 199 | self.assertFalse(pprint.isrecursive(safe), |
| 200 | "expected not isrecursive for %r" % (safe,)) |
| 201 | self.assertTrue(pprint.isreadable(safe), |
| 202 | "expected isreadable for %r" % (safe,)) |
| 203 | # PrettyPrinter methods |
| 204 | self.assertFalse(pp.isrecursive(safe), |
| 205 | "expected not isrecursive for %r" % (safe,)) |
| 206 | self.assertTrue(pp.isreadable(safe), |
| 207 | "expected isreadable for %r" % (safe,)) |
| 208 | |
| 209 | def test_unreadable(self): |
| 210 | # Not recursive but not readable anyway |
nothing calls this directly
no test coverage detected