diff --git a/dedupe/variables/exists.py b/dedupe/variables/exists.py index 00ca7eb4..72887255 100644 --- a/dedupe/variables/exists.py +++ b/dedupe/variables/exists.py @@ -5,11 +5,10 @@ from categorical import CategoricalComparator from dedupe._typing import PredicateFunction -from dedupe.variables.base import DerivedType -from dedupe.variables.categorical_type import CategoricalType +from dedupe.variables.base import DerivedType, FieldType -class ExistsType(CategoricalType): +class ExistsType(FieldType): type = "Exists" _predicate_functions: list[PredicateFunction] = [] diff --git a/tests/test_exists.py b/tests/test_exists.py new file mode 100644 index 00000000..f4129ef3 --- /dev/null +++ b/tests/test_exists.py @@ -0,0 +1,13 @@ +import unittest + +import numpy + +from dedupe.variables.exists import ExistsType + + +class TestExists(unittest.TestCase): + def test_comparator(self): + var = ExistsType("foo") + assert numpy.array_equal(var.comparator(None, None), [0, 0]) + assert numpy.array_equal(var.comparator(1, 1), [1, 0]) + assert numpy.array_equal(var.comparator(1, 0), [0, 1])