Exemplo n.º 1
0
def test_parse_search_term_class_validate_truth_good_values():
    p = ParseSearchTerm('abc')
    p.not_common_words.append('abc')
    p.strong_occurrences += 1
    p.add_occurrence('abc', 1)
    p.validate_truth()
    assert p.truth_ratio == 1
Exemplo n.º 2
0
def test_parse_search_term_class_gen_new_truth_good_value_middle():
    p = ParseSearchTerm('a b c')
    p.not_common_words.append('b')
    p.gen_new_truth()
    assert p.new_statement_that_can_be_true == 'a c'
Exemplo n.º 3
0
def test_parse_search_term_class_add_occurrence_wrong_key():
    p = ParseSearchTerm('a b')
    with pytest.raises(InputError):
        p.add_occurrence('c', 2)
Exemplo n.º 4
0
def test_parse_search_term_class_add_occurrence_float_value():
    p = ParseSearchTerm('a b')
    with pytest.raises(InputError):
        p.add_occurrence('a', 4.2)
Exemplo n.º 5
0
def test_parse_search_term_class_add_occurrence_good_value():
    p = ParseSearchTerm('a b')
    p.add_occurrence('a', 1)
    assert p.split_search_term['a'] == 1
Exemplo n.º 6
0
def test_parse_search_term_class_init_spaces_value():
    with pytest.raises(InputError):
        ParseSearchTerm('   ')
Exemplo n.º 7
0
def test_parse_search_term_class_init_good_value():
    assert type(ParseSearchTerm('search_term')) == ParseSearchTerm
Exemplo n.º 8
0
def test_search_result_interpreter_class_init_good_vales():
    p = ParseSearchTerm('abc')
    s = SearchResultInterpreter(p)
    assert type(s) == SearchResultInterpreter
Exemplo n.º 9
0
def test_search_result_class_visit_link_and_search_wrong_link():
    p = ParseSearchTerm('abc')
    s = SearchResult(p, 'abc', 'abc')
    with pytest.raises(ConnectError):
        s.visit_link_and_search()
Exemplo n.º 10
0
def test_search_result_class_init_good_vales():
    p = ParseSearchTerm('abc')
    s = SearchResult(p, 'abc', 'abc')
    assert type(s) == SearchResult