<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTestExpectation/isInverted",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTestExpectation(py)inverted"
  },
  "title" : "isInverted"
}
-->

# isInverted

Indicates that the expectation is not intended to happen.

```
var isInverted: Bool { get set }
```

## Discussion

To check that a situation does *not* occur during testing, create an expectation that is fulfilled when the unexpected situation occurs, and set its [`isInverted`](/documentation/XCTest/XCTestExpectation/isInverted) property to true. Your test will fail immediately if the inverted expectation is fulfilled.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)