def __init__(self, id, start_time, notes, table_ids, json): self.id = id self.start_time = start_time self.notes = Note(notes) self.json = json self.tables = [] for table_id in table_ids: t = Table.get_table_by_id(table_id) self.tables.append(t) t.add_reservation(self)
def test_next_string_multiple_reservations_single_table_after(): test_note = Note(None) table1 = [1, 2] table2 = [3, 4] time1 = datetime.strptime('Apr 1 2020 7:30PM', '%b %d %Y %I:%M%p') time2 = datetime.strptime('Apr 1 2020 7:45PM', '%b %d %Y %I:%M%p') res1 = (table1, time1) res2 = (table2, time2) assert test_note._next_string([res1, res2]) == "# Next: T1T2@7:30PM, T3T4@7:45PM"
def test_remove_header_only_next_string(): test_note = Note("# Next: T1@7:45PM") assert test_note.remove_header() == None
def test_remove_header_only_out_string(): test_note = Note("# Out @ 7:45PM") assert test_note.remove_header() == None
def test_remove_header_no_current_note(): test_note = Note(None) assert test_note.remove_header() == None
def test_has_header_returns_true_header_with_notes(): test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.") assert test_note.has_header() == True
def test_has_header_returns_true_only_header(): test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM") assert test_note.has_header() == True
def test_has_header_returns_true_only_nextstring(): test_note = Note("# Next: T1@7:45PM") assert test_note.has_header() == True
def empty_note(): return Note(None)
def test_notes_has_header_returns_false_on_none_note(): test_note = Note(None) assert test_note.has_header() == False
def test_set_header_with_multiple_line_note(): test_note = Note( "# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.\nSome other notes.") assert test_note.set_header("# Out @ 6:45PM", "# Next: T1@7:00PM") == \ "# Out @ 6:45PM\n# Next: T1@7:00PM\nSome notes.\nSome other notes."
def test_set_header_with_note(): test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.") assert test_note.set_header("# Out @ 6:45PM", "# Next: T1@7:00PM") == \ "# Out @ 6:45PM\n# Next: T1@7:00PM\nSome notes."
def test_set_header_only_next_string(): test_note = Note("# Next: T1@7:45PM") assert test_note.set_header( "# Out @ 6:45PM", "# Next: T1@7:00PM") == "# Out @ 6:45PM\n# Next: T1@7:00PM"
def test_set_header_no_current_note(): test_note = Note(None) assert test_note.set_header( "# Out @ 6:45PM", "# Next: T1@7:00PM") == "# Out @ 6:45PM\n# Next: T1@7:00PM"
def test_remove_header_with_note(): test_note = Note("# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.") assert test_note.remove_header() == 'Some notes.'
def test_remove_header_with_multiple_line_note(): test_note = Note( "# Out @ 7:45PM\n# Next: T1@7:45PM\nSome notes.\nSome other notes.") assert test_note.remove_header() == "Some notes.\nSome other notes."
def test_has_header_returns_true_only_outstring(): test_note = Note("# Out @ 7:45PM") assert test_note.has_header() == True