File tree Expand file tree Collapse file tree 3 files changed +9
-23
lines changed Expand file tree Collapse file tree 3 files changed +9
-23
lines changed Original file line number Diff line number Diff line change @@ -873,20 +873,15 @@ def test_binary_clf_curve_implicit_pos_label(curve_func):
873
873
np .testing .assert_allclose (int_curve_part , float_curve_part )
874
874
875
875
876
- # TODO(1.7): Update test to check for error when bytes support is removed.
877
876
@pytest .mark .filterwarnings ("ignore:Support for labels represented as bytes" )
878
877
@pytest .mark .parametrize ("curve_func" , [precision_recall_curve , roc_curve ])
879
878
@pytest .mark .parametrize ("labels_type" , ["list" , "array" ])
880
879
def test_binary_clf_curve_implicit_bytes_pos_label (curve_func , labels_type ):
881
880
# Check that using bytes class labels raises an informative
882
881
# error for any supported string dtype:
883
882
labels = _convert_container ([b"a" , b"b" ], labels_type )
884
- msg = (
885
- "y_true takes value in {b'a', b'b'} and pos_label is not "
886
- "specified: either make y_true take value in {0, 1} or "
887
- "{-1, 1} or pass pos_label explicitly."
888
- )
889
- with pytest .raises (ValueError , match = msg ):
883
+ msg = "Support for labels represented as bytes is not supported"
884
+ with pytest .raises (TypeError , match = msg ):
890
885
curve_func (labels , [0.0 , 1.0 ])
891
886
892
887
Original file line number Diff line number Diff line change @@ -358,17 +358,12 @@ def _raise_or_return():
358
358
y = check_array (y , dtype = object , ** check_y_kwargs )
359
359
360
360
try :
361
- # TODO(1.7): Change to ValueError when byte labels is deprecated.
362
- # labels in bytes format
363
361
first_row_or_val = y [[0 ], :] if issparse (y ) else y [0 ]
362
+ # labels in bytes format
364
363
if isinstance (first_row_or_val , bytes ):
365
- warnings .warn (
366
- (
367
- "Support for labels represented as bytes is deprecated in v1.5 and"
368
- " will error in v1.7. Convert the labels to a string or integer"
369
- " format."
370
- ),
371
- FutureWarning ,
364
+ raise TypeError (
365
+ "Support for labels represented as bytes is not supported. Convert "
366
+ "the labels to a string or integer format."
372
367
)
373
368
# The old sequence of sequences format
374
369
if (
Original file line number Diff line number Diff line change @@ -602,16 +602,12 @@ def test_ovr_decision_function():
602
602
assert_allclose (dec_values , dec_values_one , atol = 1e-6 )
603
603
604
604
605
- # TODO(1.7): Change to ValueError when byte labels is deprecated.
606
605
@pytest .mark .parametrize ("input_type" , ["list" , "array" ])
607
- def test_labels_in_bytes_format (input_type ):
606
+ def test_labels_in_bytes_format_error (input_type ):
608
607
# check that we raise an error with bytes encoded labels
609
608
# non-regression test for:
610
609
# https://github.com/scikit-learn/scikit-learn/issues/16980
611
610
target = _convert_container ([b"a" , b"b" ], input_type )
612
- err_msg = (
613
- "Support for labels represented as bytes is deprecated in v1.5 and will"
614
- " error in v1.7. Convert the labels to a string or integer format."
615
- )
616
- with pytest .warns (FutureWarning , match = err_msg ):
611
+ err_msg = "Support for labels represented as bytes is not supported"
612
+ with pytest .raises (TypeError , match = err_msg ):
617
613
type_of_target (target )
You can’t perform that action at this time.
0 commit comments