Commit 2de60188 authored by alat-rights's avatar alat-rights
Browse files

Completed one more test case for correct transformation, passing

parent cf12dbca
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -93,4 +93,13 @@ class TestOneHotFeaturizert(unittest.TestCase):
    """
    Test correct one hot encoding.
    """
    charset = "1234567890"
    string = "12345"
    featurizer = OneHotFeaturizer(charset=charset, max_length=100)
    feature = featurizer([string])
    assert np.allclose(feature[0][0], np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
    assert np.allclose(feature[0][1], np.array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
    assert np.allclose(feature[0][2], np.array([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]))
    assert np.allclose(feature[0][3], np.array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]))
    assert np.allclose(feature[0][4], np.array([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]))
    assert "This test case has not yet been written."