Skip to content

Commit

Permalink
Merge pull request #26 from metno/23-add-strict-argument-to-make-shou…
Browse files Browse the repository at this point in the history
…ld-shall

23 add strict argument to make should shall
  • Loading branch information
ways authored Nov 22, 2024
2 parents e5e25d2 + 68e44a5 commit b893ef8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sedr/rodeoprofile10.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def requirement7_2(jsondata: str) -> tuple[bool, str]:

def requirement7_3(jsondata) -> tuple[bool, str]:
"""Check collection identifier. Can only test B, C.
This should only be tested if --strict is set."""
Should only be tested if --strict is set."""
spec_url = f"{spec_base_url}#_collection_identifier"
approved_data_types = [
"insitu-observations",
Expand Down Expand Up @@ -116,7 +116,7 @@ def requirement7_4(jsondata: str) -> tuple[bool, str]:
# A
return (
False,
f"Collection must have a title. Error {err}. See <{spec_url}> and {spec_base_url}#_collection_title_2 for more info.",
f"Collection must have a title, but it seems to be missing. See <{spec_url}> and {spec_base_url}#_collection_title_2 for more info.",
)
return (
True,
Expand Down
11 changes: 6 additions & 5 deletions sedr/schemat.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,12 @@ def test_edr_collections(case):
) from err

if use_rodeoprofile:
requirement7_3, requirement7_3_message = rodeoprofile.requirement7_3(
jsondata=collection
)
if not requirement7_3:
raise AssertionError(requirement7_3_message)
if util.args.strict:
requirement7_3, requirement7_3_message = rodeoprofile.requirement7_3(
jsondata=collection
)
if not requirement7_3:
raise AssertionError(requirement7_3_message)

requirement7_4, requirement7_4_message = rodeoprofile.requirement7_4(
jsondata=collection
Expand Down
6 changes: 6 additions & 0 deletions sedr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def parse_args(args, version: str = "") -> argparse.Namespace:
default=False,
help="Use the rodeo profile even though the API doesn't specify it. Default False.",
)
parser.add_argument(
"--strict",
action="store_true",
default=False,
help="Treat SHOULD in any profile as SHALL. Default False.",
)

args = parser.parse_args(args)
# Parse out base_path for convenience
Expand Down

0 comments on commit b893ef8

Please sign in to comment.