def test_parse_author_and_title_case_should_parse_the_author_and_title_when_there_are_parentheses_in_the_author_name(
):
    # Given
    raw_clipping_list = [
        'Candide (Voltaire (François-Marie Arouet))',
        '- Your Highlight on page 3 | Location 184-185 | Added on Friday, April 30, 2021 12:31:29 AM',
        '', 'This is a test highlight.'
    ]
    expected = ('Voltaire (François-Marie Arouet)', 'Candide')

    # When
    actual = _parse_author_and_title(raw_clipping_list)

    # Then
    assert expected == actual
def test_parse_author_and_title_case_should_parse_the_author_and_title_when_the_author_name_is_first_name_last_name(
):
    # Given
    raw_clipping_list = [
        'Relativity (Albert Einstein)',
        '- Your Highlight on page 3 | Location 184-185 | Added on Friday, April 30, 2021 12:31:29 AM',
        '', 'This is a test highlight.'
    ]
    expected = ('Albert Einstein', 'Relativity')

    # When
    actual = _parse_author_and_title(raw_clipping_list)

    # Then
    assert expected == actual
def test_parse_author_and_title_case_should_parse_the_author_and_title_when_there_is_a_The_at_the_end_of_the_title(
):
    # Given
    raw_clipping_list = [
        'Age of Louis XIV, The (Voltaire (François-Marie Arouet))',
        '- Your Highlight on page 3 | Location 184-185 | Added on Friday, April 30, 2021 12:31:29 AM',
        '', 'This is a test highlight.'
    ]
    expected = ('Voltaire (François-Marie Arouet)', 'The Age of Louis XIV')

    # When
    actual = _parse_author_and_title(raw_clipping_list)

    # Then
    assert expected == actual
def test_parse_author_and_title_case_should_parse_the_author_and_title_when_there_are_parentheses_in_the_title(
):
    # Given
    raw_clipping_list = [
        'The Mysterious Disappearance of Leon (I Mean Noel) (Ellen Raskin)',
        '- Your Highlight on page 3 | Location 184-185 | Added on Friday, April 30, 2021 12:31:29 AM',
        '', 'This is a test highlight.'
    ]
    expected = ('Ellen Raskin',
                'The Mysterious Disappearance of Leon (I Mean Noel)')

    # When
    actual = _parse_author_and_title(raw_clipping_list)

    # Then
    assert expected == actual
示例#5
0
def test_parse_author_and_title_case_should_parse_the_author_and_title_when_the_author_name_is_formatted_with_a_comma(
):
    # Given
    raw_clipping_list = [
        "Relativity (Einstein, Albert)",
        "- Your Highlight on page 3 | Location 184-185 | Added on Friday, April 30, 2021 12:31:29 AM",
        "",
        "This is a test highlight.",
    ]
    expected = ("Albert Einstein", "Relativity")

    # When
    actual = _parse_author_and_title(raw_clipping_list)

    # Then
    assert expected == actual