Exemple #1
0
def test_parse_combined():
    searchquery = u"((fulltext=münchen) OR (title=münchen)) AND ((NOT (full=Strauß)) OR (year > 2000))"
    st = parser.parse_string(searchquery)
    left = Or(FulltextMatch(u"münchen"), AttributeMatch(u"title", u"münchen"))
    right = Or(Not(FullMatch(u"Strauß")), AttributeCompare(u"year", ">", u"2000"))
    assert isinstance(st, And)
    assert st.left == left
    assert st.right == right
Exemple #2
0
def test_parse_combined():
    searchquery = u"((fulltext=münchen) OR (title=münchen)) AND ((NOT (full=Strauß)) OR (year > 2000))"
    st = parser.parse_string(searchquery)
    left = Or(FulltextMatch(u"münchen"), AttributeMatch(u"title", u"münchen"))
    right = Or(Not(FullMatch(u"Strauß")),
               AttributeCompare(u"year", ">", u"2000"))
    assert isinstance(st, And)
    assert st.left == left
    assert st.right == right
Exemple #3
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
Exemple #4
0
def test_parse_plain_and():
    st = parser.parse_string(u'full=haus and full=ofit')
    assert st == And(FullMatch(u"haus"), FullMatch(u"ofit"))
Exemple #5
0
def test_parse_plain_or():
    st = parser.parse_string(u'full=haus or full=ofit')
    assert st == Or(FullMatch(u"haus"), FullMatch(u"ofit"))
Exemple #6
0
def test_parse_full_unicode_quoted():
    text = u'"Öffentliche schöne Häuser in München"'
    st = parser.parse_string(u'full=' + text)
    assert st == FullMatch(text.strip('"'))
Exemple #7
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
Exemple #8
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)
Exemple #9
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
Exemple #10
0
def test_parse_plain_and():
    st = parser.parse_string(u'full=haus and full=ofit')
    assert st == And(FullMatch(u"haus"), FullMatch(u"ofit"))
Exemple #11
0
def test_parse_plain_or():
    st = parser.parse_string(u'full=haus or full=ofit')
    assert st == Or(FullMatch(u"haus"), FullMatch(u"ofit"))
Exemple #12
0
def test_parse_full_unicode_quoted():
    text = u'"Öffentliche schöne Häuser in München"'
    st = parser.parse_string(u'full=' + text)
    assert st == FullMatch(text.strip('"'))
Exemple #13
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
Exemple #14
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)