def test_exclude_extension_string_no_regexp(findinfiles, qtbot): findinfiles.set_search_text("spam") findinfiles.find_options.set_directory(osp.join(LOCATION, "data")) findinfiles.find() blocker = qtbot.waitSignal(findinfiles.sig_finished) blocker.wait() matches = process_search_results(findinfiles.result_browser.data) assert expected_results() == matches
def test_case_sensitive_search(findinfiles, qtbot): findinfiles.set_search_text('HaM') findinfiles.find_options.set_directory(osp.join(LOCATION, "data")) findinfiles.find() blocker = qtbot.waitSignal(findinfiles.sig_finished) blocker.wait() matches = process_search_results(findinfiles.result_browser.data) print(matches) assert matches == {'ham.txt': [(9, 0)]}
def test_exclude_extension_multiple_string(findinfiles, qtbot): findinfiles.set_search_text("spam") findinfiles.find_options.set_directory(osp.join(LOCATION, "data")) findinfiles.find() blocker = qtbot.waitSignal(findinfiles.sig_finished) blocker.wait() matches = process_search_results(findinfiles.result_browser.data) files_filtered = True for file in matches: filename, ext = osp.splitext(file) if ext in ['.py', '.cpp']: files_filtered = False break assert files_filtered
def test_find_in_files_search(findinfiles, qtbot): """ Test the find in files utility by searching a string located on a set of known files. The results of the test should be equal to the expected search result values. """ findinfiles.set_search_text("spam") findinfiles.find_options.set_directory(osp.join(LOCATION, "data")) findinfiles.find() blocker = qtbot.waitSignal(findinfiles.sig_finished) blocker.wait() matches = process_search_results(findinfiles.result_browser.data) assert expected_results() == matches
def test_exclude_regexp_error(findinfiles, qtbot): findinfiles.set_search_text("foo") findinfiles.find_options.set_directory(osp.join(LOCATION, "data")) findinfiles.find() tooltip = findinfiles.find_options.exclude_pattern.toolTip() assert findinfiles.find_options.REGEX_ERROR in tooltip