-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 respect threshold in cli and api
- Loading branch information
1 parent
db2cc9b
commit cdee962
Showing
5 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Jane Doe | ||
Alice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from pathlib import Path | ||
|
||
from typer.testing import CliRunner | ||
|
||
from juditha.cli import cli | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_cli(fixtures_path: Path): | ||
runner.invoke(cli, ["load", "-i", fixtures_path / "names.txt"]) | ||
res = runner.invoke(cli, ["lookup", "Jane Doe"]) | ||
assert res.exit_code == 0 | ||
assert res.output.strip() == "Jane Doe" | ||
|
||
res = runner.invoke(cli, ["lookup", "doe, jane"]) | ||
assert res.exit_code == 0 | ||
assert "not found" in res.output | ||
res = runner.invoke(cli, ["lookup", "doe, jane", "--threshold", "0.5"]) | ||
assert res.exit_code == 0 | ||
assert res.output.strip() == "Jane Doe" | ||
|
||
res = runner.invoke( | ||
cli, | ||
["load", "-i", fixtures_path / "eu_authorities.ftm.json", "--from-entities"], | ||
) | ||
assert res.exit_code == 0 |