func (t *TestContext) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
	var val bool
	if err := starlark.UnpackPositionalArgs("assert", args, kwargs, 1, &val); err != nil {
		return nil, err
	}
	if !val {
		err := assertionError{
			callStack: thread.CallStack(),
		}
		t.Failures = append(t.Failures, err)
		return nil, err
	}
	return starlark.None, nil
}
CallInternal is the implementation for assert(...)
package assertmodule
import (
	"fmt"
	"sort"
	"go.starlark.net/starlark"
	"go.starlark.net/starlarkstruct"
	"go.starlark.net/syntax"
)
func AssertModule() *TestContext {
	ctx := &TestContext{}
	ctx.Attrs = starlark.StringDict{}
	for op, str := range tokenToString {
		ctx.Attrs[str] = starlark.NewBuiltin(fmt.Sprintf("assert.%s", str), ctx.AssertBinaryImpl(op))
	}
	ctx.Attrs["fails"] = starlark.NewBuiltin("assert.fails", ctx.AssertFails)
	return ctx
}
type assertionError struct {
	op        *syntax.Token
	val1      starlark.Value
	val2      starlark.Value
	msg       string
	callStack starlark.CallStack
}
func (err assertionError) Error() string {
	callStack := err.callStack[:len(err.callStack)-1]
	position := callStack.At(0).Pos.String()
	backtrace := callStack.String()
	if err.msg != "" {
		return fmt.Sprintf("[%s] assertion failed: %s\n%s", position, err.msg, backtrace)
	}
	if err.op == nil {
		return fmt.Sprintf("[%s] assertion failed\n%s", position, backtrace)
	}
	return fmt.Sprintf(
		"[%s] assertion failed: %s (type: %s) %s %s (type: %s)\n%s",
		position,
		err.val1.String(),
		err.val1.Type(),
		err.op.String(),
		err.val2.String(),
		err.val2.Type(),
		backtrace,
	)
}
type TestContext struct {
	Attrs    starlark.StringDict
	Failures []error
}
var _ starlark.HasAttrs = (*TestContext)(nil)
var _ starlark.Value = (*TestContext)(nil)
var _ starlark.Callable = (*TestContext)(nil)
func (t *TestContext) Name() string          { return "assert" }
func (t *TestContext) String() string        { return "<test_context>" }
func (t *TestContext) Type() string          { return "test_context" }
func (t *TestContext) Freeze()               { t.Attrs.Freeze() }
func (t *TestContext) Truth() starlark.Bool  { return starlark.True }
func (t *TestContext) Hash() (uint32, error) { return 0, fmt.Errorf("unhashable type: %s", t.Type()) }
func (t *TestContext) Attr(name string) (starlark.Value, error) {
	if val, ok := t.Attrs[name]; ok {
		return val, nil
	}
	return nil, nil
}
func (t *TestContext) AttrNames() []string {
	var names []string
	for name := range t.Attrs {
		names = append(names, name)
	}
	sort.Strings(names)
	return names
}