Skip to content

Commit

Permalink
ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Dec 12, 2024
1 parent ebf25e7 commit cb4b95a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion staging_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,9 @@ def load_and_validate_schema(schema_path: PathPy) -> jsonschema.Draft202012Valid
try:
jsonschema.Draft202012Validator.check_schema(dts_schema)
except jsonschema.exceptions.SchemaError as err:
raise Exception(f"Schema file {schema_path} is not a valid JSON schema: {err.message}") from err
raise Exception(
f"Schema file {schema_path} is not a valid JSON schema: {err.message}"
) from err
return jsonschema.Draft202012Validator(dts_schema)


Expand Down
12 changes: 9 additions & 3 deletions tests/import_specifications/test_individual_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,9 @@ def manifest_writer(input_json: dict | list) -> Path:
return manifest_writer


def _dts_manifest_parse_fail(input_file: Path, validator: Draft202012Validator, errors: list[Error]):
def _dts_manifest_parse_fail(
input_file: Path, validator: Draft202012Validator, errors: list[Error]
):
"""
Tests a failing DTS manifest parse.
input_file - the path to the input file. Might be a directory or not exist.
Expand All @@ -818,7 +820,9 @@ def _dts_manifest_parse_fail(input_file: Path, validator: Draft202012Validator,
assert res.errors == tuple(errors)


def test_dts_manifest_non_json(temp_dir: Generator[Path, None, None], dts_validator: Draft202012Validator):
def test_dts_manifest_non_json(
temp_dir: Generator[Path, None, None], dts_validator: Draft202012Validator
):
test_file = temp_dir / str(uuid.uuid4())
with open(test_file, "w", encoding="utf-8") as outfile:
outfile.write("totally not json")
Expand Down Expand Up @@ -850,7 +854,9 @@ def test_dts_manifest_non_dict(
)


def test_dts_manifest_not_found(temp_dir: Generator[Path, None, None], dts_validator: Draft202012Validator):
def test_dts_manifest_not_found(
temp_dir: Generator[Path, None, None], dts_validator: Draft202012Validator
):
manifest_path = temp_dir / "not_a_file"
_dts_manifest_parse_fail(
manifest_path,
Expand Down
6 changes: 1 addition & 5 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,11 +1293,7 @@ def test_load_and_validate_schema_malformed_file(tmp_path: Path):


def test_load_and_validate_schema_bad(tmp_path: Path):
invalid = {
"properties": {
"some_prop": { "type": "not_real"}
}
}
invalid = {"properties": {"some_prop": {"type": "not_real"}}}
schema_file = tmp_path / f"{uuid.uuid4()}.json"
schema_file.write_text(json.dumps(invalid), encoding="utf-8")
exp_err = f"Schema file {schema_file} is not a valid JSON schema: 'not_real' is not valid"
Expand Down

0 comments on commit cb4b95a

Please sign in to comment.