Add assert_equal(..., reple={"selector": value"}) #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I took a stab at implementing this. Here are some of the blockers I've found:
eval(repr(item)) == item
.from datetime import datetime
the repr will still bedatetime.datetime(...)
. And obviously we can't supportrepl={'["id"]': uuid4()}
because the repr is going to beUUID(...)
but that's expected.from dirty_equals import IsNow
then when we comment out theinsert_assert(...)
line linters will complain aboutIsNow
being unused. Do we comment out imports as well? I'm somewhat at a loss on this one.Maybe the answer is to not comment out the
insert_assert
line but instead just make it a no-op as long as the generatedexpected_value
matches the current one. This would fix all of the above issues but it also means that if you uninstalldirty-equals
all of your tests will now be broken and you'd have to go and delete all of theinsert_assert
statements. I thought commenting that line out was nice because the end result can run without even havingdirty-equals
installed or knowing howinsert_assert
works...