def createMockNotebook(): raw_title_wo_chapter = 'Highlight(yellow) - Page 7 · Location 151' raw_title_w_chapter = 'Highlight(yellow) - 1: The Surprising Power of Atomic Habits > Page 17 · Location 277' raw_note_w_chapter = "Note - 1: The Surprising Power of Atomic Habits > Page 17 · Location 2771" notebook = KindleNotebook() notebook.bookTitle = "Title" notebook.author = "Author" notebook.sections = [Section("Section 1"), Section("Section 2")] notes1 = [ Note(raw_title_wo_chapter, 'il texto 11'), Note(raw_title_w_chapter, 'le text 11'), Note(raw_title_w_chapter, 'le text 12'), Note(raw_note_w_chapter, 'le text 13'), ] notes2 = [ Note(raw_title_wo_chapter, 'il texto 21'), Note(raw_title_w_chapter, 'le text 21'), Note(raw_title_w_chapter, 'le text 22'), Note(raw_note_w_chapter, 'le text 23'), ] notebook.sections[0].add_note(notes1[0]) notebook.sections[0].add_note(notes1[1]) notebook.sections[0].add_note(notes1[2]) notebook.sections[0].add_note(notes1[3]) notebook.sections[1].add_note(notes2[0]) notebook.sections[1].add_note(notes2[1]) notebook.sections[1].add_note(notes2[2]) notebook.sections[1].add_note(notes2[3]) return notebook
def test_type(test_input, expected): assert Note(test_input, valid_text).type == expected
def test_postion(test_input, expected): assert Note(test_input, valid_text).position == expected
def test_chapter(test_input, expected): assert Note(test_input, valid_text).chapter == expected
def test_color(test_input, expected): assert Note(test_input, valid_text).color == expected
def test_init_check_raw_title(): with pytest.raises(ValueError): Note(invalid_raw_title_type, valid_text)
def test_init_check_text_type(): with pytest.raises(ValueError): Note(raw_title_w_chapter, invalid_text_type)