(self)
| 110 | self.assertEqual(history.entries, ["#1", "#2", "#3", "#4"]) |
| 111 | |
| 112 | def test_save(self): |
| 113 | history = History() |
| 114 | for line in ("#1", "#2", "#3", "#4"): |
| 115 | history.append_to(history.entries, line) |
| 116 | |
| 117 | # save only last 2 lines |
| 118 | history.save(self.filename, self.encoding, lines=2) |
| 119 | |
| 120 | # load again from the file |
| 121 | history = History() |
| 122 | history.load(self.filename, self.encoding) |
| 123 | |
| 124 | self.assertEqual(history.entries, ["#3", "#4"]) |
| 125 | |
| 126 | def tearDown(self): |
| 127 | self.tempdir = None |