Skip to content

Commit 8df13de

Browse files
committed
Fix lint error and skip sklearn tests when extra not installed
1 parent 6da92e3 commit 8df13de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_clean.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ def test_exception_clean_texts_parallel():
652652

653653
def test_exception_clean_transformer():
654654
"""CleanTransformer passes exceptions through."""
655+
pytest.importorskip("sklearn")
655656
from cleantext.sklearn import CleanTransformer
656657

657658
ct = CleanTransformer(no_punct=True, exceptions=[r"\w+-\w+"])
@@ -661,6 +662,7 @@ def test_exception_clean_transformer():
661662

662663
def test_exception_clean_transformer_get_params():
663664
"""CleanTransformer.get_params includes exceptions."""
665+
pytest.importorskip("sklearn")
664666
from cleantext.sklearn import CleanTransformer
665667

666668
ct = CleanTransformer(exceptions=[r"\w+-\w+"])
@@ -670,7 +672,9 @@ def test_exception_clean_transformer_get_params():
670672

671673
def test_exception_clean_transformer_clone():
672674
"""CleanTransformer can be cloned with exceptions."""
675+
pytest.importorskip("sklearn")
673676
from sklearn.base import clone
677+
674678
from cleantext.sklearn import CleanTransformer
675679

676680
ct = CleanTransformer(no_punct=True, exceptions=[r"\w+-\w+"])

0 commit comments

Comments
 (0)