def test_binary_featurizer_uses_correct_dtype_float(): f = BinaryFeaturizer() encoded = f.encode({ "a": 1.0, "b": 0.2, "c": 0.0 }, { "a": 0, "b": 3, "c": 2, "d": 1 }) assert encoded.dtype == np.float64
def test_binary_featurizer_handles_on_non_existing_features(): f = BinaryFeaturizer() encoded = f.encode({ "a": 1.0, "b": 1.0, "c": 0.0, "e": 1.0 }, { "a": 0, "b": 3, "c": 2, "d": 1 }) assert (encoded == np.array([1, 0, 0, 1])).all()