From d32bbc10d37e1e0ff07b8c29988b6aca0db389fa Mon Sep 17 00:00:00 2001 From: libretto Date: Thu, 23 May 2024 01:30:41 +0300 Subject: [PATCH] pylint fixes --- karapace/schema_models.py | 3 +- .../test_schema_avro_references.py | 63 +++++++++---------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/karapace/schema_models.py b/karapace/schema_models.py index d3e4c02f1..2874a903c 100644 --- a/karapace/schema_models.py +++ b/karapace/schema_models.py @@ -186,8 +186,7 @@ def avro_schema_merge_builder(schema_str: str, dependencies: Mapping[str, Depend if dependencies: merged_schema = "" for dependency in dependencies.values(): - merged_schema += avro_schema_merge_builder(dependency.schema.schema_str, - dependency.schema.dependencies) + ",\n" + merged_schema += avro_schema_merge_builder(dependency.schema.schema_str, dependency.schema.dependencies) + ",\n" merged_schema += schema_str return merged_schema return schema_str diff --git a/tests/integration/test_schema_avro_references.py b/tests/integration/test_schema_avro_references.py index f59510370..8dcffc66a 100644 --- a/tests/integration/test_schema_avro_references.py +++ b/tests/integration/test_schema_avro_references.py @@ -92,35 +92,32 @@ async def test_avro_references(registry_async_client: Client) -> None: assert res.status_code == 200 assert "id" in res.json() - result = {"id": 4, - "references": [ - {"name": "address.avsc", - "subject": "address", - "version": 1}, - {"name": "job.avsc", - "subject": "job", - "version": 1}], - "schema": - json.dumps({ - "fields": [ - {"name": "name", - "type": "string"}, - {"name": "age", - "type": "int"}, - {"name": "address", - "type": "Address"}, - {"name": "job", - "type": "Job"}], - "name": "Person", - "namespace": "com.netapp", - "type": "record" - }, separators=(',', ':')), - "subject": "person", - "version": 1} + result = { + "id": 4, + "references": [ + {"name": "address.avsc", "subject": "address", "version": 1}, + {"name": "job.avsc", "subject": "job", "version": 1}, + ], + "schema": json.dumps( + { + "fields": [ + {"name": "name", "type": "string"}, + {"name": "age", "type": "int"}, + {"name": "address", "type": "Address"}, + {"name": "job", "type": "Job"}, + ], + "name": "Person", + "namespace": "com.netapp", + "type": "record", + }, + separators=(",", ":"), + ), + "subject": "person", + "version": 1, + } res = await registry_async_client.get("subjects/person/versions/latest") assert res.status_code == 200 - a = res.json() assert res.json() == result schema_person["fields"] = [ @@ -167,15 +164,11 @@ async def test_avro_references(registry_async_client: Client) -> None: { "type": "record", "name": "child", - "fields": [ - {"name": "name", "type": "string"}, - {"name": "age", "type": "int"} - ] - } - ] - - } - ] + "fields": [{"name": "name", "type": "string"}, {"name": "age", "type": "int"}], + }, + ], + }, + ], } res = await registry_async_client.post(