@@ -885,7 +885,7 @@ def test_fr_object_hf_data(float_series):
885885 assert fig .data [0 ]["y" ].dtype == "float64"
886886
887887
888- def test_fwr_object_bool_data (bool_series ):
888+ def test_fr_object_bool_data (bool_series ):
889889 # First try with the original non-object bool series
890890 fig = FigureResampler ()
891891 fig .add_trace ({"name" : "s0" }, hf_y = bool_series )
@@ -902,5 +902,28 @@ def test_fwr_object_bool_data(bool_series):
902902 assert bool_series_o .dtype == object
903903 assert len (fig .hf_data ) == 1
904904 assert fig .hf_data [0 ]["y" ].dtype == "bool"
905- # plotly internally ocnverts this to object
905+ # plotly internally converts this to object
906906 assert fig .data [0 ]["y" ].dtype == "object"
907+
908+
909+ def test_fr_object_binary_data ():
910+ binary_series = np .array ([0 , 1 ]* 20 ) # as this is << max_n_samples -> limit_to_view
911+
912+ # First try with the original non-object binary series
913+ fig = FigureResampler ()
914+ fig .add_trace ({"name" : "s0" }, hf_y = binary_series , limit_to_view = True )
915+ assert len (fig .hf_data ) == 1
916+ assert fig .hf_data [0 ]["y" ].dtype == "int64"
917+ assert fig .data [0 ]["y" ].dtype == "int64"
918+ assert np .all (fig .data [0 ]["y" ] == binary_series )
919+
920+ # Now try with the object binary series
921+ binary_series_o = binary_series .astype (object )
922+
923+ fig = FigureResampler ()
924+ fig .add_trace ({"name" : "s0" }, hf_y = binary_series_o , limit_to_view = True )
925+ assert binary_series_o .dtype == object
926+ assert len (fig .hf_data ) == 1
927+ assert fig .hf_data [0 ]["y" ].dtype == "int64"
928+ assert fig .data [0 ]["y" ].dtype == "int64"
929+ assert np .all (fig .data [0 ]["y" ] == binary_series )
0 commit comments