Add test for loadLabels function

This commit is contained in:
Theresa Gresch 2019-07-17 11:59:21 +02:00
parent d63f4ec09f
commit e66f795783

View file

@ -144,6 +144,27 @@ func TestTensorFlow_Labels(t *testing.T) {
}) })
} }
func TestTensorFlow_LoadLabels(t *testing.T) {
t.Run("labels.txt exists", func(t *testing.T) {
conf := config.NewTestConfig()
tensorFlow := NewTensorFlow(conf)
path := conf.TensorFlowModelPath()
result := tensorFlow.loadLabels(path)
assert.Nil(t, result)
})
t.Run("label.txt does not exist", func(t *testing.T) {
conf := config.NewTestErrorConfig()
tensorFlow := NewTensorFlow(conf)
path := conf.TensorFlowModelPath()
result := tensorFlow.loadLabels(path)
assert.Contains(t, result.Error(), "no such file or directory")
})
}
func TestTensorFlow_LoadModel(t *testing.T) { func TestTensorFlow_LoadModel(t *testing.T) {
t.Run("model path exists", func(t *testing.T) { t.Run("model path exists", func(t *testing.T) {
conf := config.NewTestConfig() conf := config.NewTestConfig()