def test_repr(self): query = AutocompleteQuery(search_text="foo bar", suggester_name="sg") assert repr(query) == "<AutocompleteQuery [foo bar]>" query = AutocompleteQuery(search_text="aaaaabbbbb" * 200, suggester_name="sg") assert len(repr(query)) == 1024
def test_filter(self): query = AutocompleteQuery(search_text="text", suggester_name="sg") assert query.request.filter is None query.filter("expr0") assert query.request.filter == "expr0" query = AutocompleteQuery(search_text="text", suggester_name="sg", filter="expr1") assert query.request.filter == "expr1" query.filter("expr2") assert query.request.filter == "expr2"
def test_kwargs_forwarded(self, mock_request): mock_request.return_value = None AutocompleteQuery(foo=10, bar=20) assert mock_request.called assert mock_request.call_args[0] == () assert mock_request.call_args[1] == {"foo": 10, "bar": 20}
def test_init(self): query = AutocompleteQuery(search_text="text", suggester_name="sg") assert type(query.request) is AutocompleteRequest assert query.request.filter is None