コード例 #1
0
def test_everything_included(zpider_yaml_backend):
    data = _flat_value_map(zpider_yaml_backend())
    assert 'Top Level' in data, data
    assert 'Level Section' in data, data
    assert 'level summary' in data, data
    assert 'level second paragraph' in data, data
    assert 'Level Subsection' in data, data
    assert 'sublevel summary' in data, data
    assert 'sublevel second paragraph' in data, data
    assert 'Level Subsubsection 3' in data, data
    assert 'id 3 content' in data, data
    assert 'Level Subsubsection 4' in data, data
    assert 'id 4 content' in data, data
コード例 #2
0
def test_include_subsection_id_also_include_parent_id(zpider_yaml_backend):
    data = _flat_value_map(
        zpider_yaml_backend('--include-ids 2 --keep-empty-sections true'))
    assert 'Top Level' in data, data
    assert 'Level Section' in data, data
    assert 'level summary' in data, data
    assert 'level second paragraph' in data, data
    assert 'Level Subsection' in data, data
    assert 'sublevel summary' in data, data
    assert 'sublevel second paragraph' in data, data
    assert 'Level Subsubsection 3' not in data, data
    assert 'id 3 content' not in data, data
    assert 'Level Subsubsection 4' not in data, data
    assert 'id 4 content' not in data, data
コード例 #3
0
def test_exclude_id_removes_section_and_subsections(zpider_yaml_backend):
    data = _flat_value_map(
        zpider_yaml_backend('--exclude-ids 1 --keep-empty-sections true'))
    assert 'Top Level' in data, data
    assert 'Level Section' not in data, data
    assert 'level summary' not in data, data
    assert 'level second paragraph' not in data, data
    assert 'Level Subsection' not in data, data
    assert 'sublevel summary' not in data, data
    assert 'sublevel second paragraph' not in data, data
    assert 'Level Subsubsection 3' not in data, data
    assert 'id 3 content' not in data, data
    assert 'Level Subsubsection 4' not in data, data
    assert 'id 4 content' not in data, data
コード例 #4
0
def test_everything_is_included_by_default(zpider_yaml_backend):
    data = _flat_value_map(zpider_yaml_backend('--keep-all-versions true'))
    assert 'Top Level' in data, data
    assert 'Level 1 Section' in data, data
    assert 'feature 1 summary' in data, data
    assert 'Feature 1 Version 1 Subsection' in data, data
    assert 'feature 1 version 1 content' in data, data
    assert 'Feature 1 Version 2 Subsection' in data, data
    assert 'feature 1 version 2 content' in data, data
    assert 'Level 2 Section' in data, data
    assert 'feature 2 summary' in data, data
    assert 'Feature 2 Version 2 Subsection' in data, data
    assert 'feature 2 version 2 content' in data, data
    assert 'Feature 2 Version 3 Subsection' in data, data
    assert 'feature 2 version 3 content' in data, data
コード例 #5
0
def test_max_allowed_version_caps_what_versions_are_included(
        zpider_yaml_backend):
    data = _flat_value_map(zpider_yaml_backend('--max-allowed-version 2'))
    assert 'Top Level' in data, data
    assert 'Level 1 Section' in data, data
    assert 'feature 1 summary' in data, data
    assert 'Feature 1 Version 1 Subsection' not in data, data
    assert 'feature 1 version 1 content' not in data, data
    assert 'Feature 1 Version 2 Subsection' in data, data
    assert 'feature 1 version 2 content' in data, data
    assert 'Level 2 Section' in data, data
    assert 'feature 2 summary' in data, data
    assert 'Feature 2 Version 2 Subsection' in data, data
    assert 'feature 2 version 2 content' in data, data
    assert 'Feature 2 Version 3 Subsection' not in data, data
    assert 'feature 2 version 3 content' not in data, data
コード例 #6
0
def test_keep_highest_version_filters_out_everything_but_the_highest_version(
        zpider_yaml_backend):
    data = _flat_value_map(zpider_yaml_backend())
    assert 'Top Level' in data, data
    assert 'Level 1 Section' in data, data
    assert 'feature 1 summary' in data, data
    assert 'Feature 1 Version 1 Subsection' not in data, data
    assert 'feature 1 version 1 content' not in data, data
    assert 'Feature 1 Version 2 Subsection' in data, data
    assert 'feature 1 version 2 content' in data, data
    assert 'Level 2 Section' in data, data
    assert 'feature 2 summary' in data, data
    assert 'Feature 2 Version 2 Subsection' not in data, data
    assert 'feature 2 version 2 content' not in data, data
    assert 'Feature 2 Version 3 Subsection' in data, data
    assert 'feature 2 version 3 content' in data, data
コード例 #7
0
def test_max_allowed_version_excludes_everything_that_is_a_higher_version_number(
        zpider_yaml_backend):
    data = _flat_value_map(zpider_yaml_backend('--max-allowed-version 0.1'))
    assert 'Top Level' in data, data
    assert 'Level 1 Section' in data, data
    assert 'feature 1 summary' in data, data
    assert 'Feature 1 Version 1 Subsection' not in data, data
    assert 'feature 1 version 1 content' not in data, data
    assert 'Feature 1 Version 2 Subsection' not in data, data
    assert 'feature 1 version 2 content' not in data, data
    assert 'Level 2 Section' in data, data
    assert 'feature 2 summary' in data, data
    assert 'Feature 2 Version 2 Subsection' not in data, data
    assert 'feature 2 version 2 content' not in data, data
    assert 'Feature 2 Version 3 Subsection' not in data, data
    assert 'feature 2 version 3 content' not in data, data