kiteco-public/kite-go/typeinduction/mock.go
2021-12-31 23:54:19 -08:00

29 lines
619 B
Go

package typeinduction
import (
"math"
"github.com/kiteco/kiteco/kite-go/lang/python/pythonresource"
)
// MockClient returns a `*Client` that uses the provided functions
// and return types for inference.
func MockClient(manager pythonresource.Manager, funToReturn map[string]string) *Client {
var types []*Type
var functions []*Function
for fun, ret := range funToReturn {
types = append(types, &Type{
Name: ret,
})
functions = append(functions, &Function{
Name: fun,
ReturnType: []Element{
Element{ret, math.Log(.99)},
},
})
}
return ModelFromData(types, functions, manager, nil)
}