Skip to content

Commit 5f6ba83

Browse files
committed
Fixing tests
1 parent a90f66b commit 5f6ba83

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

arango/collection.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,9 +1442,11 @@ def add_fulltext_index(
14421442
name: Optional[str] = None,
14431443
in_background: Optional[bool] = None,
14441444
) -> Result[Json]:
1445-
"""Create a new fulltext index. This method is deprecated
1446-
in ArangoDB 3.10 and will be removed in a future version
1447-
of the driver.
1445+
"""Create a new fulltext index.
1446+
1447+
.. warning::
1448+
This method is deprecated since ArangoDB 3.10 and will be removed
1449+
in a future version of the driver.
14481450
14491451
:param fields: Document fields to index.
14501452
:type fields: [str]

tests/test_index.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_add_hash_index(icol):
5858
"sparse": True,
5959
"deduplicate": True,
6060
"name": "hash_index",
61-
"in_background": False,
61+
"inBackground": False,
6262
}
6363
)
6464

@@ -89,7 +89,7 @@ def test_add_skiplist_index(icol):
8989
"sparse": True,
9090
"deduplicate": True,
9191
"name": "skiplist_index",
92-
"in_background": False,
92+
"inBackground": False,
9393
}
9494
)
9595

@@ -116,9 +116,9 @@ def test_add_geo_index(icol):
116116
{
117117
"type": "geo",
118118
"fields": ["attr1"],
119-
"geo_json": True,
119+
"geoJson": True,
120120
"name": "geo_index",
121-
"in_background": True,
121+
"inBackground": True,
122122
}
123123
)
124124

@@ -140,7 +140,7 @@ def test_add_geo_index(icol):
140140
{
141141
"type": "geo",
142142
"fields": ["attr1", "attr2"],
143-
"geo_json": False,
143+
"geoJson": False,
144144
}
145145
)
146146
expected_index = {
@@ -169,9 +169,9 @@ def test_add_fulltext_index(icol):
169169
{
170170
"type": "fulltext",
171171
"fields": ["attr1"],
172-
"min_length": 10,
172+
"minLength": 10,
173173
"name": "fulltext_index",
174-
"in_background": True,
174+
"inBackground": True,
175175
}
176176
)
177177
expected_index = {
@@ -205,7 +205,7 @@ def test_add_persistent_index(icol):
205205
"unique": True,
206206
"sparse": True,
207207
"name": "persistent_index",
208-
"in_background": True,
208+
"inBackground": True,
209209
}
210210
)
211211
expected_index = {
@@ -230,9 +230,9 @@ def test_add_ttl_index(icol):
230230
{
231231
"type": "ttl",
232232
"fields": ["attr1"],
233-
"expiry_time": 1000,
233+
"expireAfter": 1000,
234234
"name": "ttl_index",
235-
"in_background": True,
235+
"inBackground": True,
236236
}
237237
)
238238
expected_index = {
@@ -280,9 +280,9 @@ def test_add_zkd_index(icol, db_version):
280280
{
281281
"type": "zkd",
282282
"fields": ["x", "y", "z"],
283-
"field_value_types": "double",
283+
"fieldValueTypes": "double",
284284
"name": "zkd_index",
285-
"in_background": False,
285+
"inBackground": False,
286286
"unique": False,
287287
}
288288
)
@@ -301,7 +301,9 @@ def test_add_zkd_index(icol, db_version):
301301
assert result["id"] in extract("id", icol.indexes())
302302

303303
with assert_raises(IndexCreateError) as err:
304-
icol.add_zkd_index(field_value_types="integer", fields=["x", "y", "z"])
304+
icol.add_index(
305+
{"type": "zkd", "fieldValueTypes": "integer", "fields": ["x", "y", "z"]}
306+
)
305307
assert err.value.error_code == 10
306308

307309
icol.delete_index(result["id"])
@@ -315,9 +317,9 @@ def test_add_mdi_index(icol, db_version):
315317
{
316318
"type": "mdi",
317319
"fields": ["x", "y", "z"],
318-
"field_value_types": "double",
320+
"fieldValueTypes": "double",
319321
"name": "mdi_index",
320-
"in_background": False,
322+
"inBackground": False,
321323
"unique": True,
322324
}
323325
)
@@ -336,7 +338,13 @@ def test_add_mdi_index(icol, db_version):
336338
assert result["id"] in extract("id", icol.indexes())
337339

338340
with assert_raises(IndexCreateError) as err:
339-
icol.add_mdi_index(field_value_types="integer", fields=["x", "y", "z"])
341+
icol.add_index(
342+
{
343+
"type": "mdi",
344+
"fieldValueTypes": "integer",
345+
"fields": ["x", "y", "z"],
346+
}
347+
)
340348
assert err.value.error_code == 10
341349

342350
icol.delete_index(result["id"])

0 commit comments

Comments
 (0)