def test_on_hot_out_of_range(): with pytest.raises(ValueError): utils.one_hot(4, 3)
def test_on_hot(): r = utils.one_hot(4, 6) assert (r[[0, 1, 2, 3, 5]] == 0).all() assert r[4] == 1