(self)
| 394 | |
| 395 | |
| 396 | def test_write_read_limited_history(self): |
| 397 | previous_length = readline.get_history_length() |
| 398 | self.addCleanup(readline.set_history_length, previous_length) |
| 399 | |
| 400 | readline.add_history("first line") |
| 401 | readline.add_history("second line") |
| 402 | readline.add_history("third line") |
| 403 | |
| 404 | readline.set_history_length(2) |
| 405 | self.assertEqual(readline.get_history_length(), 2) |
| 406 | readline.write_history_file(TESTFN) |
| 407 | self.addCleanup(os.remove, TESTFN) |
| 408 | |
| 409 | readline.read_history_file(TESTFN) |
| 410 | # Without clear_history() there's no good way to test if |
| 411 | # the correct entries are present (we're combining history limiting and |
| 412 | # possible deduplication with arbitrary previous content). |
| 413 | # So, we've only tested that the read did not fail. |
| 414 | # See TestHistoryManipulation for the full test. |
| 415 | |
| 416 | @unittest.skipUnless(hasattr(readline, "get_pre_input_hook"), |
| 417 | "get_pre_input_hook not available") |
nothing calls this directly
no test coverage detected