MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestVectorWithoutQuote

Function TestVectorWithoutQuote

query/vector/vector_test.go:751–792  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

749}
750
751func TestVectorWithoutQuote(t *testing.T) {
752 pred := "test-ve"
753 dropPredicate(pred)
754 setSchema(fmt.Sprintf(vectorSchemaWithIndex, pred, "4", "euclidean"))
755
756 setJson := `
757{
758 "set": [
759 {
760 "test-ve": [1,0],
761 "v-name":"ve1"
762 },
763 {
764 "test-ve": [0.866025,0.5],
765 "v-name":"ve2"
766 },
767 {
768 "test-ve": [0.5,0.866025],
769 "v-name":"ve3"
770 },
771 {
772 "test-ve": [0,1],
773 "v-name":"ve4"
774 },
775 {
776 "test-ve": [-0.5,0.866025],
777 "v-name":"ve5"
778 },
779 {
780 "test-ve": [-0.866025,0.5],
781 "v-name":"ve6"
782 }
783 ]
784 }
785 `
786 txn1 := client.NewTxn()
787 _, err := txn1.Mutate(context.Background(), &api.Mutation{
788 SetJson: []byte(setJson),
789 })
790 require.Error(t, err)
791 require.Contains(t, err.Error(), "Input for predicate \"test-ve\" of type vector is not vector")
792}
793
794func TestVectorTwoTxnWithoutCommit(t *testing.T) {
795 pred := "vtest"

Callers

nothing calls this directly

Calls 4

dropPredicateFunction · 0.70
setSchemaFunction · 0.70
MutateMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected