def test_with_name_prefix_miss():
    input_file_without_valid_html = MockPath(
        text_content=empty_html_template.format(
            name_title="Miss.",
            first_name="John",
            middle_name="von",
            last_name="Neumann",
        ))
    input_files = [input_file_without_valid_html]
    success_cases, failure_cases = extract_details(input_files)
    assert len(success_cases) == 1
    assert len(failure_cases) == 0
示例#2
0
def test_no_name_prefixes_provided():
    input_file_without_valid_html = MockPath(text_content="""<html>
    <body>
    <div id="author">
    <p>
    <span id="first-name">{first_name}</span>
    <span class="middle-name">{middle_name}</span>
    <span id="last-name">{last_name}</span></p>
    </div>
    </body
    </html>""".format(
        first_name="John",
        middle_name="von",
        last_name="Neumann",
    ))
    input_files = [input_file_without_valid_html]
    success_cases, failure_cases = extract_details(input_files)
    assert len(success_cases) == 0
    assert len(failure_cases) == 1
示例#3
0
def test_not_valid_html():
    input_file_without_valid_html = MockPath(text_content="foo bar")
    input_files = [input_file_without_valid_html]
    success_cases, failure_cases = extract_details(input_files)
    assert len(success_cases) == 0
    assert len(failure_cases) == 1
示例#4
0
def test_invalid_file():
    invalid_input_file = MockPath(has_valid_file_path=False)
    input_files = [invalid_input_file]
    success_cases, failure_cases = extract_details(input_files)
    assert len(success_cases) == 0
    assert len(failure_cases) == 1