(self, client)
| 176 | class TestBaseSearchFunctionality(SearchTestsBase): |
| 177 | @pytest.mark.redismod |
| 178 | def test_client(self, client): |
| 179 | num_docs = 500 |
| 180 | self.createIndex(client.ft(), num_docs=num_docs) |
| 181 | self.waitForIndex(client, getattr(client.ft(), "index_name", "idx")) |
| 182 | # verify info |
| 183 | info = client.ft().info() |
| 184 | for k in [ |
| 185 | "index_name", |
| 186 | "index_options", |
| 187 | "attributes", |
| 188 | "num_docs", |
| 189 | "max_doc_id", |
| 190 | "num_terms", |
| 191 | "num_records", |
| 192 | "inverted_sz_mb", |
| 193 | "offset_vectors_sz_mb", |
| 194 | "doc_table_size_mb", |
| 195 | "key_table_size_mb", |
| 196 | "records_per_doc_avg", |
| 197 | "bytes_per_record_avg", |
| 198 | "offsets_per_term_avg", |
| 199 | "offset_bits_per_record_avg", |
| 200 | ]: |
| 201 | assert k in info |
| 202 | |
| 203 | assert client.ft().index_name == info["index_name"] |
| 204 | assert num_docs == int(info["num_docs"]) |
| 205 | |
| 206 | res = client.ft().search("henry iv") |
| 207 | if expects_resp2_shape(client) or expects_unified_shape(client): |
| 208 | assert isinstance(res, Result) |
| 209 | assert 225 == res.total |
| 210 | assert 10 == len(res.docs) |
| 211 | assert res.duration > 0 |
| 212 | |
| 213 | for doc in res.docs: |
| 214 | assert doc.id |
| 215 | assert doc["id"] |
| 216 | assert doc.play == "Henry IV" |
| 217 | assert doc["play"] == "Henry IV" |
| 218 | assert len(doc.txt) > 0 |
| 219 | |
| 220 | # test no content |
| 221 | res = client.ft().search(Query("king").no_content()) |
| 222 | assert 194 == res.total |
| 223 | assert 10 == len(res.docs) |
| 224 | for doc in res.docs: |
| 225 | assert "txt" not in doc.__dict__ |
| 226 | assert "play" not in doc.__dict__ |
| 227 | |
| 228 | # test verbatim vs no verbatim |
| 229 | total = client.ft().search(Query("kings").no_content()).total |
| 230 | vtotal = client.ft().search(Query("kings").no_content().verbatim()).total |
| 231 | assert total > vtotal |
| 232 | |
| 233 | # test in fields |
| 234 | txt_total = ( |
| 235 | client.ft() |
nothing calls this directly
no test coverage detected