RapidFuzz icon indicating copy to clipboard operation
RapidFuzz copied to clipboard

1 test fails

Open yurivict opened this issue 2 months ago • 5 comments

========================================================================================= FAILURES ==========================================================================================
_________________________________________________________________________________ test_large_prefix_weight __________________________________________________________________________________

    def test_large_prefix_weight():
>       assert pytest.approx(JaroWinkler.similarity('milyarder', 'milyarderlik',prefix_weight=0.5)) == 1.0

tests/distance/test_JaroWinkler.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/common.py:364: in similarity
    _, sim, _, _ = self._validate(s1, s2, catch_exceptions=catch_exceptions, **kwargs)
tests/common.py:333: in _validate
    dist = call_and_maybe_catch(self._distance, s1, s2, catch_exceptions=catch_exceptions, **kwargs)
tests/common.py:41: in call_and_maybe_catch
    return call(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.common.GenericScorer object at 0x1affcd798880>, s1 = 'milyarder', s2 = 'milyarderlik', catch_exceptions = False, kwargs = {'prefix_weight': 0.5}, symmetric = True
scores = [-0.08333333333333348, 0.0]

    def _distance(self, s1, s2, catch_exceptions=False, **kwargs):
        symmetric = self.get_scorer_flags(s1, s2, **kwargs)["symmetric"]
        tester = symmetric_scorer_tester if symmetric else scorer_tester
    
        scores = [
            call_and_maybe_catch(tester, scorer.distance, s1, s2, catch_exceptions=catch_exceptions, **kwargs)
            for scorer in self.scorers
        ]
    
        if any(isinstance(score, Exception) for score in scores):
            for score in scores:
                assert compare_exceptions(score, scores[0])
            raise scores[0]
    
        scores = sorted(scores)
>       assert pytest.approx(scores[0]) == scores[-1]
E       AssertionError

tests/common.py:265: AssertionError
========================================================================= 1 failed, 385 passed in 222.58s (0:03:42) =========================================================================
*** Error code 1

Version: 3.8.0 Python: 3.9 FreeBSD 14.0

yurivict avatar Apr 07 '24 19:04 yurivict