Skip to content

Commit

Permalink
Adding test for cchecker.py:parse_options
Browse files Browse the repository at this point in the history
  • Loading branch information
sol1105 committed Jul 15, 2024
1 parent d5993f7 commit f28f321
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions compliance_checker/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import json
import os
import platform
import shutil
import subprocess
import sys
from argparse import Namespace
from collections import defaultdict
from importlib.machinery import SourceFileLoader

import pytest

Expand Down Expand Up @@ -268,3 +271,23 @@ def test_nczarr_pass_through(self, zarr_url):
output_format="text",
)
assert not errors


def test_parse_options():
"""Test the option parser of cchecker.py"""
# Load cchecker.py
cchecker = SourceFileLoader("cchecker", shutil.which("cchecker.py")).load_module()
# Simple test checker_type:checker_opt
opt_dict = cchecker.parse_options(["cf:enable_appendix_a_checks"])
assert opt_dict == defaultdict(dict, {"cf": {"enable_appendix_a_checks": None}})
# Test case checker_type:checker_opt:checker_val
opt_dict = cchecker.parse_options(
["type:opt:val", "type:opt2:val:2", "cf:enable_appendix_a_checks"],
)
assert opt_dict == defaultdict(
dict,
{
"type": {"opt": "val", "opt2": "val:2"},
"cf": {"enable_appendix_a_checks": None},
},
)

0 comments on commit f28f321

Please sign in to comment.