-
Notifications
You must be signed in to change notification settings - Fork 8
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 #34 from rskmoi/feature/fix_bug_with_long_name
Fixed bug with long name
- Loading branch information
Showing
2 changed files
with
22 additions
and
4 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,16 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from namedivider.feature.functional import _create_length_mask | ||
|
||
test_data = [ | ||
(2, 0, np.array([1, 0, 0, 0, 0, 0, 0, 0])), # short name | ||
(5, 3, np.array([0, 0, 0, 1, 0, 1, 1, 1])), # middle name | ||
(8, 1, np.array([0, 1, 1, 1, 0, 0, 0, 1])), # long name | ||
] | ||
|
||
|
||
@pytest.mark.parametrize("full_name_length, char_idx, expect", test_data) | ||
def test_create_length_mask(full_name_length: int, char_idx: int, expect: np.ndarray): | ||
mask = _create_length_mask(full_name_length=full_name_length, char_idx=char_idx) | ||
assert (mask == expect).all() |