File: test_mlipns.py

package info (click to toggle)
textdistance 4.6.3-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 448 kB
  • sloc: python: 2,728; sh: 4; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# external
import pytest

# project
import textdistance


ALG = textdistance.MLIPNS


@pytest.mark.parametrize('left, right, expected', [
    ('', '', 1),
    ('a', '', 0),
    ('', 'a', 0),
    ('a', 'a', 1),
    ('ab', 'a', 1),
    ('abc', 'abc', 1),
    ('abc', 'abcde', 1),
    ('abcg', 'abcdeg', 1),
    ('abcg', 'abcdefg', 0),
    ('Tomato', 'Tamato', 1),
    ('ato', 'Tam', 1),
])
def test_distance(left, right, expected):
    actual = ALG(external=False)(left, right)
    assert actual == expected

    actual = ALG(external=True)(left, right)
    assert actual == expected