aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_verify.py
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-11-14 03:51:25 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-11-14 03:51:25 +0100
commitb5460fe884582cd7c7e6cc4f5b6cd2f1f0af1f86 (patch)
tree205f326b0d85c2cf6180b9802e1f119a9e5dfd90 /tests/test_verify.py
parent89b9da699446c9a7566b3a9a444221fe4982058a (diff)
downloadfuzzycat-b5460fe884582cd7c7e6cc4f5b6cd2f1f0af1f86.tar.gz
fuzzycat-b5460fe884582cd7c7e6cc4f5b6cd2f1f0af1f86.zip
wip: verification and tests
Diffstat (limited to 'tests/test_verify.py')
-rw-r--r--tests/test_verify.py31
1 files changed, 31 insertions, 0 deletions
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