From 6267118acf4d29586a86f74e200487dc88ff1046 Mon Sep 17 00:00:00 2001 From: Sebastian Kunert Date: Sun, 28 Apr 2019 11:09:25 +0200 Subject: [PATCH] Fix broken tensorflow test (#107) * Fix broken tensorflow test * Introduce rounding to fix tests --- internal/photoprism/tensorflow_slow_test.go | 3 ++- internal/photoprism/tensorflow_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/photoprism/tensorflow_slow_test.go b/internal/photoprism/tensorflow_slow_test.go index e0247dc42..eb87a915a 100644 --- a/internal/photoprism/tensorflow_slow_test.go +++ b/internal/photoprism/tensorflow_slow_test.go @@ -4,6 +4,7 @@ package photoprism import ( "io/ioutil" + "math" "testing" "github.com/photoprism/photoprism/internal/test" @@ -30,6 +31,6 @@ func TestTensorFlow_GetImageTags(t *testing.T) { assert.Equal(t, "tabby", result[0].Label) assert.Equal(t, "tiger cat", result[1].Label) - assert.Equal(t, float32(0.1648176), result[1].Probability) + assert.Equal(t, float64(0.165), math.Round(float64(result[1].Probability)*1000)/1000) } } diff --git a/internal/photoprism/tensorflow_test.go b/internal/photoprism/tensorflow_test.go index f090a3f78..3cdd3d2f3 100644 --- a/internal/photoprism/tensorflow_test.go +++ b/internal/photoprism/tensorflow_test.go @@ -1,6 +1,7 @@ package photoprism import ( + "math" "testing" "github.com/photoprism/photoprism/internal/test" @@ -24,5 +25,5 @@ func TestTensorFlow_GetImageTagsFromFile(t *testing.T) { assert.Equal(t, "tabby", result[0].Label) assert.Equal(t, "tiger cat", result[1].Label) - assert.Equal(t, float32(0.1648176), result[1].Probability) + assert.Equal(t, float64(0.165), math.Round(float64(result[1].Probability)*1000)/1000) }