These are chat archives for praw-dev/praw

3rd
Mar 2018
Joe RH
@jarhill0
Mar 03 01:16
Hey @bboe, #883 (support for deleting messages) has been open for over a month, and I'd like to implement it since it's simple. However, both @dkemmet and @theriley106 have expressed interest, though not much has progressed from there. What do you recommend? Can I just implement it myself?
Bryce Boe
@bboe
Mar 03 05:31
@jarhill0 go for it. Maybe assign the issue to yourself?
Joe RH
@jarhill0
Mar 03 19:55

@bboe frustratingly, the API doesn't return any indication of whether a message was successfully deleted. I'll add a comment about that to the docstring.

Also, how do you recommend I test the functionality? I don't think I want to delete the newest message on the testing account, because that means that my code might delete a random message on someone's account if that cassette is ever re-recorded. However, the other tests for messages (link) do in fact perform actions like these, so maybe it's okay.

What's your opinion?

Huh, apparently a Redditor can send messages to themself. I'll just send a new message and then delete it.
Bryce Boe
@bboe
Mar 03 20:24
@jarhill0 those are great questions.
Most of the PRAW4 tests operate on the first thing they can.
The cassettes rarely need to be regenerated
Joe RH
@jarhill0
Mar 03 20:25
So it's safe to just delete a random message, assuming that anyone who runs tests without recorded cassettes knows what they are doing and is willing to accept the consequences?
ok
Bryce Boe
@bboe
Mar 03 20:25
Yeah, very few people are in a state where they'd run the tests without the cassettes.
And regarding the lack of confirmation, many of the API methods are that way.
Joe RH
@jarhill0
Mar 03 20:26
So should I omit the note about that?
Bryce Boe
@bboe
Mar 03 20:26
Actually I think it's good to say that nothing it returned.
It'd probably be better for many of such methods to have a similar comment.
I think I've taken the implicit approach.
Indicate what the return value is if there is one.
But do nothing if there isn't a useful return value.
Explicit is usually better though.