-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from dsi-clinic/update_classify
Update classify
- Loading branch information
Showing
2 changed files
with
92 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
from utils.classify import matcher | ||
|
||
d = { | ||
"name": [ | ||
"bob von rosevich", | ||
"anantarya smith", | ||
"bob j vonrosevich", | ||
"missy elliot", | ||
"mr johnson", | ||
"quarantin directino", | ||
"missy eliot", | ||
"joseph johnson", | ||
], | ||
"address": [ | ||
"3 Blue Drive, Chicago", | ||
"4 Blue Drive, Chicago", | ||
"8 Fancy Way, Chicago", | ||
"8 Fancy Way, Evanston", | ||
"17 Regular Road, Chicago", | ||
"42 Hollywood Boulevard, Chicago", | ||
"8 Fancy Way, Evanston", | ||
"17 Regular Road, Chicago", | ||
], | ||
} | ||
|
||
test_df = pd.DataFrame(data=d) | ||
|
||
test_df["classification"] = "neutral" | ||
|
||
|
||
@pytest.fixture | ||
def matcher_scen_1(): | ||
return test_df | ||
|
||
|
||
def test_matcher_scen_1(matcher_scen_1): | ||
matcher(matcher_scen_1, "Fancy", "address", "f") | ||
res = test_df[test_df["classification"] == "f"]["name"].values | ||
|
||
assert np.all( | ||
res == np.array(["bob j vonrosevich", "missy elliot", "missy eliot"]) | ||
) |