Beispiel #1
0
    def test_return_vector(self):
        a = _one_hot(n=10, cat=None)
        b = _one_hot(n=10, cat=5)

        b_check = np.zeros(10)
        b_check[5] = True

        assert a.dtype == "bool"
        assert b.dtype == "bool"
        assert (a == np.zeros(10)).all()
        assert (b == b_check).all()
Beispiel #2
0
 def test_index_error(self):
     with pytest.raises(IndexError):
         _ = _one_hot(10, 10)
Beispiel #3
0
 def test_normal_run(self):
     _one_hot(n=10, cat=5)
     _one_hot(n=10, cat=None)