Example #1
0
def test_empty_query_with_or():
    # When I filter by an empty query and by another word with the OR
    # operator
    query = Query.empty() | Query('cream')

    # Then I see that the query was created without extra operators
    text_type(query).should.equal('"cream"')
Example #2
0
def test_empty_query():
    # When I query for nothing
    querystr = text_type(Query.empty())

    # Then I see that this query object won't return anything just yet
    querystr.should.be.empty
Example #3
0
def test_user_input_empty():
    query = Query.from_user_input('')

    str(query).should.equal('*:*')
Example #4
0
def test_user_input_two_words_or():
    query = Query.from_user_input('ice cream', default_op='OR')

    str(query).should.equal('("ice" OR "cream")')
Example #5
0
def test_user_input_with_two_words_and_double_spaces_between_them():
    query = Query.from_user_input('ice  cream', default_op='AND')

    str(query).should.equal('("ice" AND "cream")')
Example #6
0
def test_user_input_two_words_and():
    query = Query.from_user_input('ice cream', default_op='AND')

    str(query).should.equal('("ice" AND "cream")')
Example #7
0
def test_user_input_with_spaces_around_it():
    query = Query.from_user_input(' simple ')

    str(query).should.equal('"simple"')
Example #8
0
def test_user_input_simple():
    query = Query.from_user_input('simple')

    str(query).should.equal('"simple"')