-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
split assert - avoid split if message, handle comments #52
Conversation
@Zac-HD I think I'm hitting a bug somewhere that's making it impossible to differentiate assert(
a # first
and b # second
) with assert(a # first # second
and b
) (which is a pretty common issue, since having multiple When running the tests, they both show up with identical I'll try digging into the testing infrastructure to see if the file is read in some janky way or what's going on, but thought I'd raise it since you might have a better idea of what's going on. |
Oh derp, it's because shed runs assert a and b # first # second |
Ah, right. I'm disinclined to care more about comments than Black itself does, so if you can't reproduce the pattern by using longer variable names I would just skip this case. |
once I figured out that Black's been messing with my test cases everything makes a lot more sense, so will have a finished implementation soon. Can't 100% guarantee that comments are in the right places, but I don't wanna throw away any comments at least. |
a6ed8ff
to
fa1a8b1
Compare
4c898cf
to
2291638
Compare
Done! assert a and b; assert c and d but black will split those up anyway and then they're handled. |
2291638
to
34e7577
Compare
The PR did end up madly complicated, and I'm somewhat tempted to want to throw it in the bin - the former implementation straight up eating comments is probably the only thing that makes it worth it. Though if I'd redone it from scratch I'd write a wayy simpler implementation and not give a crap on where the comments go. |
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.
Whew, yeah, that certainly is an implementation. Agree that "not eating comments" is important and also that it's not so ugly as to be worth refactoring at this stage. Thanks for the feature; splitting assertions should make it easier to understand what's going on in logs when things fail!
Not triggering on messages was easy, but handling comments was ... hilariously stupid. Turns out the relevant comments can be put in like ... six or seven places? So the code is absolutely stupid and unreadable, but it at least works for all test cases currently written.
TODO: