From b5460fe884582cd7c7e6cc4f5b6cd2f1f0af1f86 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Sat, 14 Nov 2020 03:51:25 +0100 Subject: wip: verification and tests --- tests/test_verify.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/test_verify.py (limited to 'tests/test_verify.py') diff --git a/tests/test_verify.py b/tests/test_verify.py new file mode 100644 index 0000000..be4b0ec --- /dev/null +++ b/tests/test_verify.py @@ -0,0 +1,31 @@ +import operator +import os +import yaml +try: + from yaml import CLoader as Loader +except ImportError: + from yaml import Loader + +from fuzzycat.verify import compare, Status + + +def test_verify_cases(): + """ + Test verification cases, via yaml. + """ + status_map = { + "AMBIGUOUS": Status.AMBIGUOUS, + "DIFFERENT": Status.DIFFERENT, + "EXACT": Status.EXACT, + "STRONG": Status.STRONG, + "WEAK": Status.WEAK, + } + fields = operator.itemgetter("a", "b", "status", "about") + folder = os.path.join(os.path.dirname(__file__), "test_verify") + for root, _, files in os.walk(folder): + for fn in files: + with open(os.path.join(root, fn)) as f: + doc = yaml.load(f, Loader=Loader) + a, b, status, about = fields(doc) + result, _ = compare(a, b) + assert status_map.get(status) == result, about -- cgit v1.2.3