@@ -41,6 +41,18 @@ def test_basic_search_with_empty_params(self):
41
41
assert response ['hits' ][0 ]['id' ] == '166428'
42
42
assert '_formatted' not in response ['hits' ][0 ]
43
43
44
+ def test_basic_search_with_empty_query (self ):
45
+ """Tests search with empty query and empty params"""
46
+ response = self .index .search ('' , {})
47
+ assert isinstance (response , object )
48
+ assert len (response ['hits' ]) == 0
49
+
50
+ def test_basic_search_with_placeholder (self ):
51
+ """Tests search with no query [None] and empty params"""
52
+ response = self .index .search (None , {})
53
+ assert isinstance (response , object )
54
+ assert len (response ['hits' ]) == 20
55
+
44
56
def test_custom_search (self ):
45
57
"""Tests search with an simple query and custom parameter (attributesToHighlight)"""
46
58
response = self .index .search (
@@ -54,6 +66,17 @@ def test_custom_search(self):
54
66
assert '_formatted' in response ['hits' ][0 ]
55
67
assert 'dragon' in response ['hits' ][0 ]['_formatted' ]['title' ].lower ()
56
68
69
+ def test_custom_search_with_placeholder (self ):
70
+ """Tests search with no query [None] and custom parameter (attributesToHighlight)"""
71
+ response = self .index .search (
72
+ None ,
73
+ {
74
+ 'limit' : 5
75
+ }
76
+ )
77
+ assert isinstance (response , object )
78
+ assert len (response ['hits' ]) == 5
79
+
57
80
def test_custom_search_params_with_wildcard (self ):
58
81
"""Tests search with '*' in query params"""
59
82
response = self .index .search (
0 commit comments