コード例 #1
0
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
コード例 #2
0
def test_type(test_input, expected):
    assert Note(test_input, valid_text).type == expected
コード例 #3
0
def test_postion(test_input, expected):
    assert Note(test_input, valid_text).position == expected
コード例 #4
0
def test_chapter(test_input, expected):
    assert Note(test_input, valid_text).chapter == expected
コード例 #5
0
def test_color(test_input, expected):
    assert Note(test_input, valid_text).color == expected
コード例 #6
0
def test_init_check_raw_title():
    with pytest.raises(ValueError):
        Note(invalid_raw_title_type, valid_text)
コード例 #7
0
def test_init_check_text_type():
    with pytest.raises(ValueError):
        Note(raw_title_w_chapter, invalid_text_type)