MCPcopy Create free account
hub / github.com/gavv/httpexpect / NotContainsValue

Method NotContainsValue

object.go:1084–1105  ·  view source on GitHub ↗

NotContainsValue succeeds if object does not contain given value with any key. Before comparison, both object and value are converted to canonical form. Example: object := NewObject(t, map[string]interface{}{"foo": 123}) object.NotContainsValue(456)

(value interface{})

Source from the content-addressed store, hash-verified

1082// object := NewObject(t, map[string]interface{}{"foo": 123})
1083// object.NotContainsValue(456)
1084func (o *Object) NotContainsValue(value interface{}) *Object {
1085 opChain := o.chain.enter("NotContainsValue()")
1086 defer opChain.leave()
1087
1088 if opChain.failed() {
1089 return o
1090 }
1091
1092 if key, ok := containsValue(opChain, o.value, value); ok {
1093 opChain.fail(AssertionFailure{
1094 Type: AssertNotContainsElement,
1095 Actual: &AssertionValue{o.value},
1096 Expected: &AssertionValue{value},
1097 Errors: []error{
1098 errors.New("expected: map does not contain element (with any key)"),
1099 fmt.Errorf("found matching element with key %q", key),
1100 },
1101 })
1102 }
1103
1104 return o
1105}
1106
1107// ContainsSubset succeeds if given value is a subset of object.
1108// Before comparison, both object and value are converted to canonical form.

Callers 2

TestObject_FailedChainFunction · 0.80
TestObject_ContainsValueFunction · 0.80

Calls 6

containsValueFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80
ErrorfMethod · 0.65

Tested by 2

TestObject_FailedChainFunction · 0.64
TestObject_ContainsValueFunction · 0.64