(self)
| 323 | self.assertEqual(pprint.saferepr(cont), expected) |
| 324 | |
| 325 | def test_basic_line_wrap(self): |
| 326 | # verify basic line-wrapping operation |
| 327 | o = {'RPM_cal': 0, |
| 328 | 'RPM_cal2': 48059, |
| 329 | 'Speed_cal': 0, |
| 330 | 'controldesk_runtime_us': 0, |
| 331 | 'main_code_runtime_us': 0, |
| 332 | 'read_io_runtime_us': 0, |
| 333 | 'write_io_runtime_us': 43690} |
| 334 | exp = """\ |
| 335 | {'RPM_cal': 0, |
| 336 | 'RPM_cal2': 48059, |
| 337 | 'Speed_cal': 0, |
| 338 | 'controldesk_runtime_us': 0, |
| 339 | 'main_code_runtime_us': 0, |
| 340 | 'read_io_runtime_us': 0, |
| 341 | 'write_io_runtime_us': 43690}""" |
| 342 | for type in [dict, dict2]: |
| 343 | self.assertEqual(pprint.pformat(type(o)), exp) |
| 344 | |
| 345 | exp = """\ |
| 346 | frozendict({'RPM_cal': 0, |
| 347 | 'RPM_cal2': 48059, |
| 348 | 'Speed_cal': 0, |
| 349 | 'controldesk_runtime_us': 0, |
| 350 | 'main_code_runtime_us': 0, |
| 351 | 'read_io_runtime_us': 0, |
| 352 | 'write_io_runtime_us': 43690})""" |
| 353 | self.assertEqual(pprint.pformat(frozendict(o)), exp) |
| 354 | exp = """\ |
| 355 | frozendict2({'RPM_cal': 0, |
| 356 | 'RPM_cal2': 48059, |
| 357 | 'Speed_cal': 0, |
| 358 | 'controldesk_runtime_us': 0, |
| 359 | 'main_code_runtime_us': 0, |
| 360 | 'read_io_runtime_us': 0, |
| 361 | 'write_io_runtime_us': 43690})""" |
| 362 | self.assertEqual(pprint.pformat(frozendict2(o)), exp) |
| 363 | |
| 364 | o = range(100) |
| 365 | exp = 'dict_keys([%s])' % ',\n '.join(map(str, o)) |
| 366 | keys = dict.fromkeys(o).keys() |
| 367 | self.assertEqual(pprint.pformat(keys), exp) |
| 368 | keys = frozendict.fromkeys(o).keys() |
| 369 | self.assertEqual(pprint.pformat(keys), exp) |
| 370 | |
| 371 | o = range(100) |
| 372 | exp = 'dict_values([%s])' % ',\n '.join(map(str, o)) |
| 373 | values = {v: v for v in o}.values() |
| 374 | self.assertEqual(pprint.pformat(values), exp) |
| 375 | values = frozendict({v: v for v in o}).values() |
| 376 | self.assertEqual(pprint.pformat(values), exp) |
| 377 | |
| 378 | o = range(100) |
| 379 | exp = 'dict_items([%s])' % ',\n '.join("(%s, %s)" % (i, i) for i in o) |
| 380 | items = {v: v for v in o}.items() |
| 381 | self.assertEqual(pprint.pformat(items), exp) |
| 382 | items = frozendict({v: v for v in o}).items() |
nothing calls this directly
no test coverage detected