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"')
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
def test_user_input_empty(): query = Query.from_user_input('') str(query).should.equal('*:*')
def test_user_input_two_words_or(): query = Query.from_user_input('ice cream', default_op='OR') str(query).should.equal('("ice" OR "cream")')
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")')
def test_user_input_two_words_and(): query = Query.from_user_input('ice cream', default_op='AND') str(query).should.equal('("ice" AND "cream")')
def test_user_input_with_spaces_around_it(): query = Query.from_user_input(' simple ') str(query).should.equal('"simple"')
def test_user_input_simple(): query = Query.from_user_input('simple') str(query).should.equal('"simple"')