From 72e1deedcfa5f63c2456b3a338af49e692c9faba Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 14 Sep 2023 13:20:26 +0200 Subject: [PATCH] Add tests for CoverArtImage __repr__() and __str__() --- test/test_coverart_image.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_coverart_image.py b/test/test_coverart_image.py index 952706f2bce..50573d87ee0 100644 --- a/test/test_coverart_image.py +++ b/test/test_coverart_image.py @@ -55,6 +55,23 @@ def create_image(extra_data, types=None, support_types=False, class CoverArtImageTest(PicardTestCase): + def test_repr_str_1(self): + image = CoverArtImage( + url='url', types=["booklet", "front"], + comment='comment', support_types=True, + support_multi_types=True + ) + expected = "CoverArtImage(url='url', types=['booklet', 'front'], support_types=True, support_multi_types=True, comment='comment')" + self.assertEqual(expected, repr(image)) + expected = "Image from url of type booklet,front and comment 'comment'" + self.assertEqual(expected, str(image)) + + def test_repr_str_2(self): + image = CoverArtImage() + expected = "CoverArtImage(support_types=False, support_multi_types=False)" + self.assertEqual(expected, repr(image)) + expected = "Image" + self.assertEqual(expected, str(image)) def test_is_front_image_no_types(self): image = create_image(b'a')