Skip to content

Commit cfd032d

Browse files
committed
Fix async server tests
1 parent b27433c commit cfd032d

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

test_elasticsearch/test_async/test_server/test_clients.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ async def test_indices_analyze_unicode(async_client, kwargs):
3939
}
4040

4141

42-
async def test_bulk_works_with_string_body(self, async_client):
42+
async def test_bulk_works_with_string_body(async_client):
4343
docs = '{ "index" : { "_index" : "bulk_test_index", "_id" : "1" } }\n{"answer": 42}'
4444
response = await async_client.bulk(body=docs)
4545

4646
assert response["errors"] is False
4747
assert len(response["items"]) == 1
4848

4949

50-
async def test_bulk_works_with_bytestring_body(self, async_client):
50+
async def test_bulk_works_with_bytestring_body(async_client):
5151
docs = (
5252
b'{ "index" : { "_index" : "bulk_test_index", "_id" : "2" } }\n{"answer": 42}'
5353
)

test_elasticsearch/test_async/test_server/test_helpers.py

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,9 @@ def sync_gen():
123123

124124
async def test_all_errors_from_chunk_are_raised_on_failure(self, async_client):
125125
await async_client.indices.create(
126-
"i",
127-
{
128-
"mappings": {"properties": {"a": {"type": "integer"}}},
129-
"settings": {"number_of_shards": 1, "number_of_replicas": 0},
130-
},
126+
index="i",
127+
mappings={"properties": {"a": {"type": "integer"}}},
128+
settings={"number_of_shards": 1, "number_of_replicas": 0},
131129
)
132130
await async_client.cluster.health(wait_for_status="yellow")
133131

@@ -334,11 +332,9 @@ async def test_stats_only_reports_numbers(self, async_client):
334332

335333
async def test_errors_are_reported_correctly(self, async_client):
336334
await async_client.indices.create(
337-
"i",
338-
{
339-
"mappings": {"properties": {"a": {"type": "integer"}}},
340-
"settings": {"number_of_shards": 1, "number_of_replicas": 0},
341-
},
335+
index="i",
336+
mappings={"properties": {"a": {"type": "integer"}}},
337+
settings={"number_of_shards": 1, "number_of_replicas": 0},
342338
)
343339
await async_client.cluster.health(wait_for_status="yellow")
344340

@@ -360,11 +356,9 @@ async def test_errors_are_reported_correctly(self, async_client):
360356

361357
async def test_error_is_raised(self, async_client):
362358
await async_client.indices.create(
363-
"i",
364-
{
365-
"mappings": {"properties": {"a": {"type": "integer"}}},
366-
"settings": {"number_of_shards": 1, "number_of_replicas": 0},
367-
},
359+
index="i",
360+
mappings={"properties": {"a": {"type": "integer"}}},
361+
settings={"number_of_shards": 1, "number_of_replicas": 0},
368362
)
369363
await async_client.cluster.health(wait_for_status="yellow")
370364

@@ -406,11 +400,9 @@ async def test_ignore_error_if_raised(self, async_client):
406400

407401
async def test_errors_are_collected_properly(self, async_client):
408402
await async_client.indices.create(
409-
"i",
410-
{
411-
"mappings": {"properties": {"a": {"type": "integer"}}},
412-
"settings": {"number_of_shards": 1, "number_of_replicas": 0},
413-
},
403+
index="i",
404+
mappings={"properties": {"a": {"type": "integer"}}},
405+
settings={"number_of_shards": 1, "number_of_replicas": 0},
414406
)
415407
await async_client.cluster.health(wait_for_status="yellow")
416408

@@ -867,7 +859,7 @@ async def test_reindex_passes_kwargs_to_scan_and_bulk(
867859
bulk_kwargs={"refresh": True},
868860
)
869861

870-
assert await async_client.indices.exists("prod_index")
862+
assert await async_client.indices.exists(index="prod_index")
871863
assert (
872864
50
873865
== (await async_client.count(index="prod_index", q="type:answers"))["count"]
@@ -886,7 +878,7 @@ async def test_reindex_accepts_a_query(self, async_client, reindex_setup):
886878
)
887879
await async_client.indices.refresh()
888880

889-
assert await async_client.indices.exists("prod_index")
881+
assert await async_client.indices.exists(index="prod_index")
890882
assert (
891883
50
892884
== (await async_client.count(index="prod_index", q="type:answers"))["count"]
@@ -900,7 +892,7 @@ async def test_all_documents_get_moved(self, async_client, reindex_setup):
900892
await helpers.async_reindex(async_client, "test_index", "prod_index")
901893
await async_client.indices.refresh()
902894

903-
assert await async_client.indices.exists("prod_index")
895+
assert await async_client.indices.exists(index="prod_index")
904896
assert (
905897
50
906898
== (await async_client.count(index="prod_index", q="type:questions"))[

0 commit comments

Comments
 (0)