示例#1
0
    def _read_file(self):
        self._test_writable()
        current_lines = []
        with open(self.filename, 'r') as the_file:
            for line in the_file:
                line = line.rstrip()
                if LedgerThing.is_new_thing(line):
                    self._add_thing_from_lines(
                        self._remove_trailing_blank_lines(current_lines)
                    )
                    current_lines = []

                current_lines.append(line)

        self._add_thing_from_lines(
            self._remove_trailing_blank_lines(current_lines)
        )
示例#2
0
 def test_is_not_thing(self):
     self.assertFalse(LedgerThing.is_new_thing(''))
示例#3
0
 def test_is_new_thing(self):
     self.assertTrue(LedgerThing.is_new_thing('2013/04/15 ab store'))