@@ -3,9 +3,9 @@ package feast
33import (
44 "encoding/json"
55 "errors"
6+ "fmt"
67 "github.com/mmcloughlin/geohash"
78 "github.com/stretchr/testify/assert"
8- "fmt"
99 "testing"
1010)
1111
@@ -84,7 +84,7 @@ func TestGeohash(t *testing.T) {
8484 latitudeJsonPath : "$.latitudeArrays" ,
8585 longitudeJsonPath : "$.longitudeArrays" ,
8686 precision : 12 ,
87- expValue : []string {
87+ expValue : []interface {} {
8888 geohash .Encode (1.0 , 1.0 ),
8989 geohash .Encode (2.0 , 2.0 ),
9090 },
@@ -93,7 +93,7 @@ func TestGeohash(t *testing.T) {
9393
9494 for _ , test := range tests {
9595 t .Run (test .name , func (t * testing.T ) {
96- udf := & UdfEnv {UnmarshalledJsonRequest :testJsonUnmarshallled }
96+ udf := & UdfEnv {UnmarshalledJsonRequest : testJsonUnmarshallled }
9797 udfResult := udf .Geohash (test .latitudeJsonPath , test .longitudeJsonPath , test .precision )
9898 if udfResult .Error != nil {
9999 if test .expError != nil {
@@ -183,7 +183,7 @@ func TestS2ID(t *testing.T) {
183183 latitudeJsonPath : "$.latitudeArrays" ,
184184 longitudeJsonPath : "$.longitudeArrays" ,
185185 level : 12 ,
186- expValue : []string {
186+ expValue : []interface {} {
187187 "1153277815093723136" ,
188188 "1154346540395921408" ,
189189 },
@@ -192,7 +192,7 @@ func TestS2ID(t *testing.T) {
192192
193193 for _ , test := range tests {
194194 t .Run (test .name , func (t * testing.T ) {
195- udf := & UdfEnv {UnmarshalledJsonRequest :testJsonUnmarshallled }
195+ udf := & UdfEnv {UnmarshalledJsonRequest : testJsonUnmarshallled }
196196 udfResult := udf .S2ID (test .latitudeJsonPath , test .longitudeJsonPath , test .level )
197197 if udfResult .Error != nil {
198198 if test .expError != nil {
@@ -244,25 +244,25 @@ func TestJsonExtract(t *testing.T) {
244244 name : "should be able to extract array value using nested key from JSON string" ,
245245 keyJsonPath : "$.array" ,
246246 nestedJsonPath : "$.child_node.array[*]" ,
247- extractedValue : []interface {}{float64 (1 ), float64 (2 )},
247+ extractedValue : []interface {}{float64 (1 ), float64 (2 )},
248248 },
249249 {
250250 name : "should throw error when value specified by key does not exist in nested JSON" ,
251251 keyJsonPath : "$.nested" ,
252252 nestedJsonPath : "$.child_node.does_not_exist_node" ,
253- expError : fmt .Errorf ("key error: does_not_exist_node not found in object" ),
253+ expError : fmt .Errorf ("key error: does_not_exist_node not found in object" ),
254254 },
255255 {
256256 name : "should throw error when value obtained by key is not valid json" ,
257257 keyJsonPath : "$.not_json" ,
258258 nestedJsonPath : "$.not_exist" ,
259- expError : fmt .Errorf ("the value specified in path `$.not_json` should be a valid JSON" ),
259+ expError : fmt .Errorf ("the value specified in path `$.not_json` should be a valid JSON" ),
260260 },
261261 {
262262 name : "should throw error when value obtained by key is not string" ,
263263 keyJsonPath : "$.not_string" ,
264264 nestedJsonPath : "$.not_exist" ,
265- expError : fmt .Errorf ("the value specified in path `$.not_string` should be of string type" ),
265+ expError : fmt .Errorf ("the value specified in path `$.not_string` should be of string type" ),
266266 },
267267 }
268268
@@ -280,4 +280,4 @@ func TestJsonExtract(t *testing.T) {
280280 assert .Equal (t , test .extractedValue , actual )
281281 })
282282 }
283- }
283+ }
0 commit comments