Code Duplication    Length = 23-24 lines in 2 locations

tests/test_pylast.py 2 locations

@@ 1802-1825 (lines=24) @@
1799
        self.assertFalse(found1)
1800
        self.assertFalse(found2)
1801
1802
    @handle_lastfm_exceptions
1803
    def test_set_tags(self):
1804
        # Arrange
1805
        tags = ["sometag1", "sometag2"]
1806
        artist = self.network.get_artist("Test Artist")
1807
        artist.add_tags(tags)
1808
        tags_before = artist.get_tags()
1809
        new_tags = ["settag1", "settag2"]
1810
1811
        # Act
1812
        artist.set_tags(new_tags)
1813
1814
        # Assert
1815
        tags_after = artist.get_tags()
1816
        self.assertNotEqual(tags_before, tags_after)
1817
        self.assertEqual(len(tags_after), 2)
1818
        found1, found2 = False, False
1819
        for tag in tags_after:
1820
            if tag.name == "settag1":
1821
                found1 = True
1822
            elif tag.name == "settag2":
1823
                found2 = True
1824
        self.assertTrue(found1)
1825
        self.assertTrue(found2)
1826
1827
    @handle_lastfm_exceptions
1828
    def test_tracks_notequal(self):
@@ 1778-1800 (lines=23) @@
1775
                break
1776
        self.assertFalse(found)
1777
1778
    @handle_lastfm_exceptions
1779
    def test_remove_tags(self):
1780
        # Arrange
1781
        tags = ["removetag1", "removetag2"]
1782
        artist = self.network.get_artist("Test Artist")
1783
        artist.add_tags(tags)
1784
        artist.add_tags("1more")
1785
        tags_before = artist.get_tags()
1786
1787
        # Act
1788
        artist.remove_tags(tags)
1789
1790
        # Assert
1791
        tags_after = artist.get_tags()
1792
        self.assertEqual(len(tags_after), len(tags_before) - 2)
1793
        found1, found2 = False, False
1794
        for tag in tags_after:
1795
            if tag.name == "removetag1":
1796
                found1 = True
1797
            elif tag.name == "removetag2":
1798
                found2 = True
1799
        self.assertFalse(found1)
1800
        self.assertFalse(found2)
1801
1802
    @handle_lastfm_exceptions
1803
    def test_set_tags(self):