Skip to content

Commit

Permalink
pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
libretto committed May 22, 2024
1 parent d934d9c commit d32bbc1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 37 deletions.
3 changes: 1 addition & 2 deletions karapace/schema_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 28 additions & 35 deletions tests/integration/test_schema_avro_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = [
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d32bbc1

Please sign in to comment.