def main(): n = Note('hello') print('Testing of class Note') print() print(type(n)) print(dir(n)) print(n.__str__()) print(n.__init__) print(n.__dict__) print(n.tags) print(n.memo) print(n.creation_date) print(n.match('hello')) print(n.match('hi')) print(n.id) nb = Notebook() print('Testing of class Notebook') print() print(type(nb)) print(dir(nb)) print(nb.__str__()) print(nb.__init__) print(nb.__dict__) print(nb.notes) print(nb.new_note('hi'))
from menu import Menu note = Note('I am Steve Jobs!', 'Steve Jobs') notebook = Notebook() print("Created note: 'I am Steve Jobs!'") print("Created notebook.") print("\nIs notebook an object?", isinstance(notebook, object)) print("Is note an object?", isinstance(note, object)) print("Is notebook.new_note('Elon Musk', 'Elon') an object?", isinstance(notebook.new_note('Elon Musk'), object)) print("Is notebook.search('Elon') an object?", isinstance(notebook.search('Elon'), object)) print("Is notebook.__init__() an object?", isinstance(notebook.__init__(), object)) print("Is notebook.__str__() a string?", isinstance(notebook.__str__(), str)) print("Is note.memo a string?", isinstance(note.memo, str)) print("Is notebook an object of class Notebook?", isinstance(notebook, Notebook)) print("\nIs the word 'Steve' in note?", note.match('I')) print("Is the word 'love' in note?", note.match('love')) print("\nAdding new notes to the notebook...") notebook.new_note('You are not Steve Jobs!', 'answer 1') notebook.new_note('I am.', 'answer 2') for note in notebook.notes: print('Memo: {}, Tag: {}.'.format(note.memo, note.tags)) print("\nModifying memo of the first note:") notebook.modify_memo(notebook.notes[0].id, 'Nice boy')