def _create_timesheet(self, text, add_date_to_bottom=False): aliases_database.update({ 'foo': Mapping(mapping=(123, 456), backend='test'), 'bar': Mapping(mapping=(12, 34), backend='test'), }) entries = EntriesCollection(text) entries.add_date_to_bottom = add_date_to_bottom return Timesheet(entries)
def _create_timesheet(self, text, add_date_to_bottom=False): aliases_database.update({ 'foo': Mapping(mapping=(123, 456), backend='test'), 'bar': Mapping(mapping=(12, 34), backend='test'), }) entries = EntriesCollection(text) entries.add_date_to_bottom = add_date_to_bottom return Timesheet(entries)
def test_insert_to_top(): entries_collection = EntriesCollection("""20.01.2014 _internal 0800-0900 Fix coffee machine""") entries_collection.add_date_to_bottom = False entries_date = datetime.date(2014, 1, 21) entries_collection[entries_date].append( TimesheetEntry('taxi', 4, 'Work a bit')) assert entries_collection.lines[0].text == "21.01.2014" assert entries_collection.lines[1].text == "" assert entries_collection.lines[2].text == "taxi 4 Work a bit"
def test_insert_to_top(): entries_collection = EntriesCollection("""20.01.2014 _internal 0800-0900 Fix coffee machine""") entries_collection.add_date_to_bottom = False entries_date = datetime.date(2014, 1, 21) entries_collection[entries_date].append( TimesheetEntry('taxi', 4, 'Work a bit') ) assert entries_collection.lines[0].text == "21.01.2014" assert entries_collection.lines[1].text == "" assert entries_collection.lines[2].text == "taxi 4 Work a bit"
def _create_timesheet(self, text, add_date_to_bottom=False): mappings = {'foo': (123, 456), 'bar': (12, 34)} entries = EntriesCollection(text) entries.add_date_to_bottom = add_date_to_bottom return Timesheet(entries, mappings)