示例#1
0
文件: __init__.py 项目: ralf57/taxi
    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)
示例#2
0
    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)
示例#3
0
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"
示例#4
0
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"
示例#5
0
    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)