From cb4b95a0287c36adb1c9827acffc7ab3025469db Mon Sep 17 00:00:00 2001 From: Bill Riehl Date: Wed, 11 Dec 2024 21:58:47 -0500 Subject: [PATCH] ruff formatting --- staging_service/app.py | 4 +++- .../import_specifications/test_individual_parsers.py | 12 +++++++++--- tests/test_app.py | 6 +----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/staging_service/app.py b/staging_service/app.py index 14922cd6..4c34f841 100644 --- a/staging_service/app.py +++ b/staging_service/app.py @@ -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) diff --git a/tests/import_specifications/test_individual_parsers.py b/tests/import_specifications/test_individual_parsers.py index a719e5ea..8c6c3af4 100644 --- a/tests/import_specifications/test_individual_parsers.py +++ b/tests/import_specifications/test_individual_parsers.py @@ -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. @@ -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") @@ -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, diff --git a/tests/test_app.py b/tests/test_app.py index 899c1c6a..07d167db 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -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"