Skip to content

Commit

Permalink
Fix strip python type (#1602)
Browse files Browse the repository at this point in the history
* update

* the fix

* Revert "update"

This reverts commit 4c2f32f.

* add a test and rebase

* style

* oups
  • Loading branch information
ArthurZucker authored Aug 7, 2024
1 parent bded212 commit 49dafd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bindings/python/src/normalizers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl PyNormalizer {
Py::new(py, (PyBertNormalizer {}, base))?.into_py(py)
}
NormalizerWrapper::StripNormalizer(_) => {
Py::new(py, (PyBertNormalizer {}, base))?.into_py(py)
Py::new(py, (PyStrip {}, base))?.into_py(py)
}
NormalizerWrapper::Prepend(_) => Py::new(py, (PyPrepend {}, base))?.into_py(py),
NormalizerWrapper::ByteLevel(_) => {
Expand Down
5 changes: 3 additions & 2 deletions bindings/python/tests/bindings/test_normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ def test_can_make_sequences(self):
assert output == "hello"

def test_items(self):
normalizers = Sequence([BertNormalizer(True, True), Prepend()])
normalizers = Sequence([BertNormalizer(True, True), Prepend(), Strip()])
assert normalizers[1].__class__ == Prepend
normalizers[0].lowercase = False
assert not normalizers[0].lowercase
assert normalizers[2].__class__ == Strip
with pytest.raises(IndexError):
print(normalizers[2])
print(normalizers[3])


class TestLowercase:
Expand Down

0 comments on commit 49dafd7

Please sign in to comment.