Skip to content

Commit

Permalink
Merge pull request #1997 from praw-dev/general-cleanup
Browse files Browse the repository at this point in the history
General cleanup
  • Loading branch information
LilSpazJoekp authored Nov 26, 2023
2 parents 8bb5285 + a26fbec commit afbaa6c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1,054 deletions.
4 changes: 2 additions & 2 deletions praw/models/reddit/subreddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3058,9 +3058,9 @@ def _parse_xml_response(self, response: Response):
)

def _read_and_post_media(
self, media_path: str, upload_url: str, upload_data: dict[str, Any]
self, file: Path, upload_url: str, upload_data: dict[str, Any]
) -> Response:
with media_path.open("rb") as media:
with file.open("rb") as media:
return self._reddit._core._requestor._http.post(
upload_url, data=upload_data, files={"file": media}
)
Expand Down
2 changes: 1 addition & 1 deletion praw/models/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def stream_generator(
function: Callable,
*,
attribute_name: str = "fullname",
continue_after_id: str | None = None,
exclude_before: bool = False,
pause_after: int | None = None,
skip_existing: bool = False,
continue_after_id: str | None = None,
**function_kwargs: Any,
) -> Generator[Any, None, None]:
"""Yield new items from ``function`` as they become available.
Expand Down
2 changes: 1 addition & 1 deletion praw/objector.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, reddit: praw.Reddit, parsers: dict[str, Any] | None = None):
self._reddit = reddit

def _objectify_dict( # noqa: PLR0912,PLR0915
self, data: dict[str:Any]
self, data: dict[str, Any]
) -> RedditBase:
"""Create :class:`.RedditBase` objects from dicts.
Expand Down

This file was deleted.

This file was deleted.

20 changes: 10 additions & 10 deletions tests/integration/models/reddit/test_subreddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ def patch_request(url, *args, **kwargs):
@mock.patch(
"websocket.create_connection", new=MagicMock(side_effect=BlockingIOError)
) # happens with timeout=0
@pytest.mark.cassette_name("TestSubreddit.test_submit_image__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_image")
def test_submit_image__timeout_1(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1644,7 +1644,7 @@ def test_submit_image__timeout_1(self, image_path, reddit):
# happens with timeout=0.00001
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_image__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_image")
def test_submit_image__timeout_2(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1660,7 +1660,7 @@ def test_submit_image__timeout_2(self, image_path, reddit):
), # happens with timeout=0.1
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_image__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_image")
def test_submit_image__timeout_3(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1676,7 +1676,7 @@ def test_submit_image__timeout_3(self, image_path, reddit):
), # could happen, and PRAW should handle it
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_image__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_image")
def test_submit_image__timeout_4(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1692,7 +1692,7 @@ def test_submit_image__timeout_4(self, image_path, reddit):
), # from issue #1124
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_image__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_image")
def test_submit_image__timeout_5(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand Down Expand Up @@ -1853,7 +1853,7 @@ def test_submit_video__thumbnail(self, image_path, reddit):
@mock.patch(
"websocket.create_connection", new=MagicMock(side_effect=BlockingIOError)
) # happens with timeout=0
@pytest.mark.cassette_name("TestSubreddit.test_submit_video__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_video")
def test_submit_video__timeout_1(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1868,7 +1868,7 @@ def test_submit_video__timeout_1(self, image_path, reddit):
# happens with timeout=0.00001
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_video__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_video")
def test_submit_video__timeout_2(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1884,7 +1884,7 @@ def test_submit_video__timeout_2(self, image_path, reddit):
), # happens with timeout=0.1
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_video__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_video")
def test_submit_video__timeout_3(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1900,7 +1900,7 @@ def test_submit_video__timeout_3(self, image_path, reddit):
), # could happen, and PRAW should handle it
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_video__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_video")
def test_submit_video__timeout_4(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand All @@ -1916,7 +1916,7 @@ def test_submit_video__timeout_4(self, image_path, reddit):
), # from issue #1124
),
)
@pytest.mark.cassette_name("TestSubreddit.test_submit_video__timeout")
@pytest.mark.cassette_name("TestSubreddit.test_submit_video")
def test_submit_video__timeout_5(self, image_path, reddit):
reddit.read_only = False
subreddit = reddit.subreddit(pytest.placeholders.test_subreddit)
Expand Down

0 comments on commit afbaa6c

Please sign in to comment.