People: Add unit tests #22

This commit is contained in:
theresa
2021-08-26 11:58:52 +02:00
parent 01742c13ea
commit 3a601f3953
2 changed files with 83 additions and 2 deletions

View File

@@ -58,6 +58,10 @@ func TestUnmarshalEmbedding(t *testing.T) {
r := UnmarshalEmbedding("-0.013,-0.031]")
assert.Nil(t, r)
})
t.Run("invalid json", func(t *testing.T) {
r := UnmarshalEmbedding("[true, false]")
assert.Equal(t, []float64{0, 0}, r)
})
}
func TestUnmarshalEmbeddings(t *testing.T) {
@@ -69,4 +73,8 @@ func TestUnmarshalEmbeddings(t *testing.T) {
r := UnmarshalEmbeddings("-0.013,-0.031]")
assert.Nil(t, r)
})
t.Run("invalid json", func(t *testing.T) {
r := UnmarshalEmbeddings("[[true, false]]")
assert.Equal(t, [][]float64{{0, 0}}, r)
})
}