Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
Ejemplo n.º 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"))
Ejemplo n.º 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"))
Ejemplo n.º 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('"'))
Ejemplo n.º 7
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
Ejemplo n.º 8
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)
Ejemplo n.º 9
0
def test_parse_not():
    st = parser.parse_string(u'not(full=torpedo)')
    assert st == Not(FullMatch(u"torpedo"))
Ejemplo n.º 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"))
Ejemplo n.º 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"))
Ejemplo n.º 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('"'))
Ejemplo n.º 13
0
def test_parse_simple_query(simple_query):
    searchquery, expected = simple_query
    st = parser.parse_string(searchquery)
    assert st == expected
Ejemplo n.º 14
0
def test_parse_unicode():
    text = u"πλανήτης\uEEEE"
    st = parser.parse_string(u"full=" + text)
    assert st == FullMatch(text)