diff options
| author | Cody Logan <cody@lokken.dev> | 2023-11-07 11:41:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-07 11:41:49 -0800 |
| commit | 5129ad62392948a033ee988e4093d095f5005c77 (patch) | |
| tree | 5df144f6970d7d015bce94cff4516a388b5cddab /src/wikiget/file.py | |
| parent | bc5d19c8150bf7960839243ceeb6f62a9df54e18 (diff) | |
| parent | 7c2dadfa38ac08a060f2df987b7d0b7f2f0b5ad0 (diff) | |
| download | wikiget-5129ad62392948a033ee988e4093d095f5005c77.tar.gz wikiget-5129ad62392948a033ee988e4093d095f5005c77.zip | |
Merge pull request #12 from clpo13/improve-tests
Improve tests and test coverage
Diffstat (limited to 'src/wikiget/file.py')
| -rw-r--r-- | src/wikiget/file.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wikiget/file.py b/src/wikiget/file.py index 0f639d3..8de62ae 100644 --- a/src/wikiget/file.py +++ b/src/wikiget/file.py @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with Wikiget. If not, see <https://www.gnu.org/licenses/>. +from typing import Any + from mwclient.image import Image from wikiget import DEFAULT_SITE @@ -43,3 +45,21 @@ class File: self.name = name self.dest = dest if dest else name self.site = site if site else DEFAULT_SITE + + def __eq__(self, other: Any) -> bool: + """ + Compares this File object with another for equality. + + :param other: another File to compare + :type other: File + :return: True if the Files are equal and False otherwise + :rtype: bool + """ + if not isinstance(other, File): + return NotImplemented + return ( + self.image == other.image + and self.name == other.name + and self.dest == other.dest + and self.site == other.site + ) |
