File tree Expand file tree Collapse file tree 5 files changed +16
-11
lines changed
asyncpraw/models/reddit/mixins
tests/integration/models/reddit Expand file tree Collapse file tree 5 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ Async PRAW follows `semantic versioning <http://semver.org/>`_.
66Unreleased
77----------
88
9+ **Changed **
10+
11+ - Revert :meth: `~.Comment.edit ` positional argument deprecation.
12+ - Revert :meth: `~.Submission.edit ` positional argument deprecation.
13+
914**Fixed **
1015
1116- An issue where :class: `.ModmailConversation `'s ``messages `` attribute would only
Original file line number Diff line number Diff line change 22from typing import TYPE_CHECKING , Union
33
44from ....const import API_PATH
5- from ...util import _deprecate_args
65
76if TYPE_CHECKING : # pragma: no cover
87 import asyncpraw
@@ -27,9 +26,8 @@ async def delete(self):
2726 """
2827 await self ._reddit .post (API_PATH ["del" ], data = {"id" : self .fullname })
2928
30- @_deprecate_args ("body" )
3129 async def edit (
32- self , * , body : str
30+ self , body : str
3331 ) -> Union ["asyncpraw.models.Comment" , "asyncpraw.models.Submission" ]:
3432 """Replace the body of the object with ``body``.
3533
@@ -46,7 +44,7 @@ async def edit(
4644 # construct the text of an edited comment
4745 # by appending to the old body:
4846 edited_body = comment.body + "Edit: thanks for the gold!"
49- await comment.edit(body= edited_body)
47+ await comment.edit(edited_body)
5048
5149 """
5250 data = {
Original file line number Diff line number Diff line change 11"""Provide the ReplyableMixin class."""
2- from typing import TYPE_CHECKING , Optional
2+ from typing import TYPE_CHECKING , Optional , Union
33
44from ....const import API_PATH
55
1010class ReplyableMixin :
1111 """Interface for :class:`.RedditBase` classes that can be replied to."""
1212
13- async def reply (self , body : str ) -> Optional ["asyncpraw.models.Comment" ]:
13+ async def reply (
14+ self , body : str
15+ ) -> Optional [Union ["asyncpraw.models.Comment" , "asyncpraw.models.Message" ]]:
1416 """Reply to the object.
1517
1618 :param body: The Markdown formatted content for a comment.
1719
18- :returns: A :class:`.Comment` object for the newly created comment or ``None``
19- if Reddit doesn't provide one.
20+ :returns: A :class:`.Comment` or :class:`.Message` object for the newly created
21+ comment or message or ``None`` if Reddit doesn't provide one.
2022
2123 :raises: ``asyncprawcore.exceptions.Forbidden`` when attempting to reply to some
2224 items, such as locked submissions/comments or non-replyable messages.
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ async def test_edit(self, _):
6767 self .reddit .read_only = False
6868 with self .use_cassette ():
6969 comment = Comment (self .reddit , "fwxxs5d" )
70- await comment .edit (body = "New text" )
70+ await comment .edit ("New text" )
7171 assert comment .body == "New text"
7272
7373 async def test_enable_inbox_replies (self ):
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async def test_edit(self, _):
6666 self .reddit .read_only = False
6767 with self .use_cassette ():
6868 submission = Submission (self .reddit , "hmkbt8" )
69- await submission .edit (body = "New text" )
69+ await submission .edit ("New text" )
7070 assert submission .selftext == "New text"
7171
7272 @mock .patch ("asyncio.sleep" , return_value = None )
@@ -76,7 +76,7 @@ async def test_edit_invalid(self, _):
7676 with self .use_cassette ():
7777 submission = Submission (self .reddit , "hmkfoy" )
7878 with pytest .raises (RedditAPIException ):
79- await submission .edit (body = "rewtwert" )
79+ await submission .edit ("rewtwert" )
8080
8181 async def test_enable_inbox_replies (self ):
8282 self .reddit .read_only = False
You can’t perform that action at this time.
0 commit comments