aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-11-16 09:47:27 -0800
committerCody Logan <cody@lokken.dev>2023-11-16 09:47:27 -0800
commitce58a03caa6f4d9e3cb01898b4b73716031b24dd (patch)
tree7f673b61b991e57abc0de2880ff15092d3d1b019
parent86fb1a4315a39d09524c1a632d26ee7a66eacb4f (diff)
downloadwikiget-ce58a03caa6f4d9e3cb01898b4b73716031b24dd.tar.gz
wikiget-ce58a03caa6f4d9e3cb01898b4b73716031b24dd.zip
Add tests for file string methods
-rw-r--r--tests/test_file_class.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_file_class.py b/tests/test_file_class.py
index a8afe55..4ad06d1 100644
--- a/tests/test_file_class.py
+++ b/tests/test_file_class.py
@@ -73,3 +73,22 @@ class TestFileComparison:
"""
not_a_file = {"name": "foobar.jpg", "dest": "foobar.jpg"}
assert file_with_name.__eq__(not_a_file) == NotImplemented
+
+
+class TestFileStrings:
+ """Define tests related to wikiget.file.File string representations."""
+
+ def test_file_str(self, file_with_name: File) -> None:
+ """Test that str(File) produces the correct output."""
+ expected_output = (
+ "{'name': 'foobar.jpg', 'dest': PosixPath('foobar.jpg'), "
+ "'site': 'commons.wikimedia.org', 'image': None}"
+ )
+ assert str(file_with_name) == expected_output
+
+ def test_file_repr(self, file_with_name: File) -> None:
+ """Test that repr(File) produces the correct output."""
+ expected_output = (
+ 'File("foobar.jpg", "foobar.jpg", "commons.wikimedia.org", None)'
+ )
+ assert repr(file_with_name) == expected_output