Skip to content

Commit

Permalink
Group conformance related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
titusz committed Feb 11, 2022
1 parent fdbe66a commit 6bae9c7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion iscc_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__version__ = "0.2.0"
from iscc_core.options import core_opts, options_conformant
from iscc_core.options import core_opts, conformant_options
from iscc_core import v0

# Import full api to toplevel
Expand Down
6 changes: 3 additions & 3 deletions iscc_core/conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
TEST_DATA = HERE / "data.json"


def generate_tests():
def conformance_testdata():
# type: () -> Generator[Tuple[str, Callable, List[Any], List[Any]]]
"""
Yield tuples of test data.
Expand Down Expand Up @@ -75,7 +75,7 @@ def generate_tests():
yield test_name, func_obj, test_values["inputs"], test_values["outputs"]


def selftest(): # pragma: no cover
def conformance_selftest(): # pragma: no cover
# type: () -> bool
"""
Run conformance tests.
Expand All @@ -84,7 +84,7 @@ def selftest(): # pragma: no cover
:rtype: bool
"""
passed = True
for test_name, func, inputs, outputs in generate_tests():
for test_name, func, inputs, outputs in conformance_testdata():
try:
if func(*inputs) != outputs:
raise AssertionError(f"FAILED: {func.__name__}.{test_name}")
Expand Down
4 changes: 2 additions & 2 deletions iscc_core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class Config:
has_logged_confromance = False


def check_options(opts):
def conformance_check_options(opts):
# type: (CoreOptions) -> bool
"""Check and log if options have non-default conformance critical values"""
global has_logged_confromance
Expand All @@ -373,4 +373,4 @@ def check_options(opts):


core_opts = CoreOptions()
options_conformant = check_options(core_opts)
conformant_options = conformance_check_options(core_opts)
2 changes: 1 addition & 1 deletion tests/test_0_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_options_nonstandard():
import iscc_core

assert iscc_core.core_opts.meta_trim_name == 666
assert iscc_core.options_conformant is False
assert iscc_core.conformant_options is False
iscc_core.core_opts.meta_trim_name = 128


Expand Down
6 changes: 3 additions & 3 deletions tests/test_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@


def test_generate_tests():
test_generator = conformance.generate_tests()
test_generator = conformance.conformance_testdata()
assert isinstance(test_generator, Generator)


def test_confromance_selftest():
assert conformance.selftest()
assert conformance.conformance_selftest()


@pytest.mark.parametrize("testname,function,inputs,outputs", conformance.generate_tests())
@pytest.mark.parametrize("testname,function,inputs,outputs", conformance.conformance_testdata())
def test_conformance(testname, function, inputs, outputs):
result = function(*inputs)
if hasattr(result, "dict"):
Expand Down

0 comments on commit 6bae9c7

Please sign in to comment.