<s> from __future__ import unicode_literals <EOL> import datetime <EOL> from taxi . timesheet . entry import EntriesCollection , TimesheetEntry <EOL> def test_entries_collection_from_string ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> assert len ( entries_collection ) == <NUM_LIT:1> <EOL> assert len ( entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] ) == <NUM_LIT:2> <EOL> def test_add_entry_to_entries_collection ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] . append ( <EOL> TimesheetEntry ( '<STR_LIT>' , <NUM_LIT:4> , '<STR_LIT>' ) <EOL> ) <EOL> assert len ( entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] ) == <NUM_LIT:2> <EOL> def test_edit_entry_description ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] [ <NUM_LIT:0> ] . description = "<STR_LIT>" <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_edit_entry_duration ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] [ <NUM_LIT:0> ] . duration = <NUM_LIT:5> <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_edit_entry_alias ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] [ <NUM_LIT:0> ] . alias = '<STR_LIT>' <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_edit_entry_commented ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] [ <NUM_LIT:0> ] . commented = True <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_edit_entry_ignored ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_collection [ datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) ] [ <NUM_LIT:0> ] . ignored = True <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_remove_entry_removes_line ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_date = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) <EOL> del entries_collection [ entries_date ] [ <NUM_LIT:1> ] <EOL> assert len ( entries_collection [ entries_date ] ) == <NUM_LIT:1> <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == u"<STR_LIT>" <EOL> def test_remove_last_entry_removes_date ( ) : <EOL> entries_collection = EntriesCollection ( <EOL> "<STR_LIT>" <EOL> ) <EOL> entries_date = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) <EOL> del entries_collection [ entries_date ] [ <NUM_LIT:0> ] <EOL> assert len ( entries_collection . lines ) == <NUM_LIT:0> <EOL> def test_remove_date_removes_lines ( ) : <EOL> entries_collection = EntriesCollection ( """<STR_LIT>""" ) <EOL> entries_date = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:20> ) <EOL> del entries_collection [ entries_date ] <EOL> assert len ( entries_collection . lines ) == <NUM_LIT:2> <EOL> assert entries_collection . lines [ <NUM_LIT:0> ] . text == "<STR_LIT>" <EOL> def test_insert_to_bottom ( ) : <EOL> entries_collection = EntriesCollection ( """<STR_LIT>""" ) <EOL> entries_collection . add_date_to_bottom = True <EOL> entries_date = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> ) <EOL> entries_collection [ entries_date ] . append ( <EOL> TimesheetEntry ( '<STR_LIT>' , <NUM_LIT:4> , '<STR_LIT>' ) <EOL> ) <EOL> assert entries_collection . lines [ - <NUM_LIT:3> ] . text == "<STR_LIT>" <EOL> assert entries_collection . lines [ - <NUM_LIT:2> ] . text == "<STR_LIT>" <EOL> assert entries_collection . lines [ - <NUM_LIT:1> ] . text == "<STR_LIT>" <EOL> def test_insert_to_top ( ) : <EOL> entries_collection = EntriesCollection ( """<STR_LIT>""" ) <EOL> entries_collection . add_date_to_bottom = False <EOL> entries_date = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT> ) <EOL> entries_collection [ entries_date ] . append ( <EOL> TimesheetEntry ( '<STR_LIT>' , <NUM_LIT:4> , '<STR_LIT>' ) <EOL> ) <EOL> assert entries_collection . lines [ <NUM_LIT:0> ] . text == "<STR_LIT>" <EOL> assert entries_collection . lines [ <NUM_LIT:1> ] . text == "<STR_LIT>" <EOL> assert entries_collection . lines [ <NUM_LIT:2> ] . text == "<STR_LIT>" </s>
