Skip to content

Commit 13351f2

Browse files
committed
update description
1 parent a594b3a commit 13351f2

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

asdf/_commands/validate.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ def setup_arguments(cls, subparsers):
1515
parser = subparsers.add_parser(
1616
"validate",
1717
help="Validates an ASDF file.",
18-
description="validates \n - against all tagged schemas (and optionally a custom schema) \n - blocks with stored checksums (can be disabled)",
18+
description=(
19+
"Validates tree against all tagged schemas (and optionally a custom schema) "
20+
"and blocks with stored checksums."
21+
),
1922
)
2023

2124
parser.add_argument("filename", help="path to ASDF file")
@@ -39,14 +42,17 @@ def run(cls, args):
3942
validate(args.filename, args.custom_schema, args.skip_block_validation)
4043

4144

42-
def validate(filename, custom_schema, skip_checksums):
45+
def validate(filename, custom_schema, skip_block_validation):
4346
# if we are skipping checksums we can lazy load, otherwise don't
4447
with asdf.open(
45-
filename, custom_schema=custom_schema, validate_checksums=not skip_checksums, lazy_load=skip_checksums
48+
filename,
49+
custom_schema=custom_schema,
50+
validate_checksums=not skip_block_validation,
51+
lazy_load=skip_block_validation,
4652
) as af: # noqa: F841
4753
msg = f"{filename} is valid"
4854
if custom_schema:
4955
msg += f", conforms to {custom_schema}"
50-
if not skip_checksums:
51-
msg += ", and block checksums match"
56+
if not skip_block_validation:
57+
msg += ", and block checksums match contents"
5258
print(msg)

asdf/_tests/commands/test_validate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ def test_invalid(invalid_file_path):
7272

7373
def test_custom_schema(valid_file_path, custom_schema_path):
7474
with pytest.raises(asdf.ValidationError):
75-
main.main_from_args(["validate", str(valid_file_path), "--custom_schema", str(custom_schema_path)])
75+
main.main_from_args(["validate", str(valid_file_path), "--custom-schema", str(custom_schema_path)])
7676

7777

7878
def test_block_checksum(bad_blocks_file_path):
7979
with pytest.raises(ValueError, match="does not match given checksum"):
8080
main.main_from_args(["validate", str(bad_blocks_file_path)])
8181

8282

83-
def test_skip_checksums(bad_blocks_file_path):
84-
assert main.main_from_args(["validate", str(bad_blocks_file_path), "--skip_checksums"]) == 0
83+
def test_skip_block_validation(bad_blocks_file_path):
84+
assert main.main_from_args(["validate", str(bad_blocks_file_path), "--skip-block-validation"]) == 0

0 commit comments

Comments
 (0)