def run_event_loop(): my_journal = Journal('personal') command = query_user() while command != 'x': if command == 'l': my_journal.list() elif command == 'a': my_journal.add(input('Enter your journal entry:\n')) command = query_user() my_journal.save()
def test_journal_add_new_content(): if os.path.exists(file_path): os.remove(file_path) entry_1 = 'This is my first entry journal entry' expected = 'Your 1 journal entry\n\n1. {}\n'.format(entry_1) journal = Journal() journal.add(entry_1) actual = journal.list() assert expected == actual
def main(): journal = Journal() menu = Menu() selection = menu.prompt() while selection != 'x': if selection == 'l': print(journal.list()) elif selection == 'a': journal.add(input('Enter your journal entry:\n')) selection = menu.prompt() journal.save()