-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add IsNotType assertion #1730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add IsNotType assertion #1730
Conversation
This commit introduces the `IsNotType` assertion, which is the inverse of the existing `IsType` assertion. It allows users to assert that an object is not of a specific type. Additionally, minor documentation improvements were made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds legitimate. I face the need this week too.
Please fix the small typos
This commit fixes a typo in the IsType source file, which caused incorrect behavior in the generated files for the `assert` and `require` packages.
This commit updates the generated files in the `assert` and `require` packages to reflect the changes made in the source file for `IsType`.
I have addressed all the requested changes:
Let me know if there's anything else you'd like me to adjust. |
Simplified the failure message in `IsNotType` to avoid redundancy and improve clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thanks
This commit introduces the
IsNotType
assertion, which is the inverse of the existingIsType
assertion. It allows users to assert that an object is not of a specific type.Additionally, minor documentation improvements were made.
Summary
This PR adds a new assertion function,
IsNotType
, to thetestify/assert
package. It complements the existingIsType
function by providing a way to assert that an object is not of a specific type.Changes
IsNotType
function to theassert
package.IsNotType
to ensure correctness.IsNotType
.Motivation
The
testify/assert
package already provides anIsType
function to check if an object is of a specific type. However, there was no built-in way to assert that an object is not of a specific type. This PR addresses that gap by introducing theIsNotType
function, improving the library's completeness and usability.Example usage
Related issues
N/A