-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
insert_assert
#117
Comments
Hey, I tried insert_assert and loved it! I would like and could implement a nice feature but would be interested whether you'd like to merge it: Add a version (or a configuration) of insert_assert that captures values from locals(), compares their values to parts of the object to be asserted (i.e. if it's a dict, then we'll check the keys and values recursively), and inserts variable names instead of raw values. It is very useful when the value being checked is dynamic such as a date or a uuid. Essentially using aliases in place of literals whenever possible. |
I think this is often an anti pattern in testing as it can make the test less declarative, I'd rather avoid it. If you want to implement it, happy to review a PR, but it should be behind a flag. |
Is this issue still open as a reminder to add insert_assert to the documentation? |
I guess so. |
@zmievsa I'm hoping to add something like what you're describing to a similar library here: 15r10nk/inline-snapshot#53 It won't automatically generate code using variables, but if it sees variables or other expressions inside an existing snapshot, it'll try to preserve them. |
we should move samuelcolvin/dirty-equals#51 to this package.
Function should be
debug.insert_assert
, but we still need the library to become a pytest plugin so tests withinsert_assert
can fail.The text was updated successfully, but these errors were encountered: