From ecaa8a2d019cef5a83a8dc0ed1d4ad5c9fc81a72 Mon Sep 17 00:00:00 2001 From: Cody Logan Date: Wed, 8 Nov 2023 12:00:45 -0800 Subject: Add and refine docstrings in tests folder. --- tests/conftest.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index cda7dd3..5fccfc0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,13 +15,44 @@ # You should have received a copy of the GNU General Public License # along with Wikiget. If not, see . +"""Define fixtures used across all tests in this folder.""" + import pytest import requests_mock as rm +from wikiget.file import File + + +@pytest.fixture() +def file_with_name() -> File: + """Create a test File with only a filename. + + A File object created with only a name should set its destination property to + the same value and its site property to the program's default site. + + :return: File object created using a filename + :rtype: File + """ + return File("foobar.jpg") + + +@pytest.fixture() +def file_with_name_and_dest() -> File: + """Create a test File with a name and destination. + + :return: File object created with name and dest + :rtype: File + """ + return File(name="foobar.jpg", dest="bazqux.jpg") + @pytest.fixture() def _mock_get(requests_mock: rm.Mocker) -> None: - # fake the download request for File:Example.jpg + """Fake the download request for the true URL of File:Example.jpg. + + :param requests_mock: a requests_mock Mocker object + :type requests_mock: rm.Mocker + """ requests_mock.get( "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg", text="data", -- cgit v1.2.3