Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix exists variables, closes #1196 #1197

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dedupe/variables/exists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []

Expand Down
13 changes: 13 additions & 0 deletions tests/test_exists.py
Original file line number Diff line number Diff line change
@@ -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])
Loading