From c330f3abc3addcfa40bcb9b376724b0d091d15d0 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Sun, 29 May 2016 03:56:39 -0400 Subject: [PATCH] replace deprecated assert_() with assertTrue() --- test/test_autotag.py | 10 +++++----- test/test_files.py | 2 +- test/test_library.py | 26 +++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/test_autotag.py b/test/test_autotag.py index 71fbdad73..00857ae97 100644 --- a/test/test_autotag.py +++ b/test/test_autotag.py @@ -47,7 +47,7 @@ class PluralityTest(_common.TestCase): def test_plurality_conflict(self): objs = [1, 1, 2, 2, 3] obj, freq = plurality(objs) - self.assert_(obj in (1, 2)) + self.assertTrue(obj in (1, 2)) self.assertEqual(freq, 2) def test_plurality_empty_sequence_raises_error(self): @@ -879,17 +879,17 @@ class StringDistanceTest(unittest.TestCase): def test_leading_the_has_lower_weight(self): dist1 = string_dist(u'XXX Band Name', u'Band Name') dist2 = string_dist(u'The Band Name', u'Band Name') - self.assert_(dist2 < dist1) + self.assertTrue(dist2 < dist1) def test_parens_have_lower_weight(self): dist1 = string_dist(u'One .Two.', u'One') dist2 = string_dist(u'One (Two)', u'One') - self.assert_(dist2 < dist1) + self.assertTrue(dist2 < dist1) def test_brackets_have_lower_weight(self): dist1 = string_dist(u'One .Two.', u'One') dist2 = string_dist(u'One [Two]', u'One') - self.assert_(dist2 < dist1) + self.assertTrue(dist2 < dist1) def test_ep_label_has_zero_weight(self): dist = string_dist(u'My Song (EP)', u'My Song') @@ -898,7 +898,7 @@ class StringDistanceTest(unittest.TestCase): def test_featured_has_lower_weight(self): dist1 = string_dist(u'My Song blah Someone', u'My Song') dist2 = string_dist(u'My Song feat Someone', u'My Song') - self.assert_(dist2 < dist1) + self.assertTrue(dist2 < dist1) def test_postfix_the(self): dist = string_dist(u'The Song Title', u'Song Title, The') diff --git a/test/test_files.py b/test/test_files.py index e27e317cb..e302f0846 100644 --- a/test/test_files.py +++ b/test/test_files.py @@ -200,7 +200,7 @@ class AlbumFileTest(_common.TestCase): self.ai.store() self.i.load() - self.assert_('newAlbumName' in self.i.path) + self.assertTrue('newAlbumName' in self.i.path) def test_albuminfo_move_moves_file(self): oldpath = self.i.path diff --git a/test/test_library.py b/test/test_library.py index 4d6a51b93..af285048a 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -244,7 +244,7 @@ class DestinationTest(_common.TestCase): def test_path_with_format(self): self.lib.path_formats = [(u'default', u'$artist/$album ($format)')] p = self.i.destination() - self.assert_('(FLAC)' in p) + self.assertTrue('(FLAC)' in p) def test_heterogeneous_album_gets_single_directory(self): i1, i2 = item(), item() @@ -883,7 +883,7 @@ class ArtDestinationTest(_common.TestCase): def test_art_filename_respects_setting(self): art = self.ai.art_destination('something.jpg') - self.assert_('%sartimage.jpg' % os.path.sep in art) + self.assertTrue('%sartimage.jpg' % os.path.sep in art) def test_art_path_in_item_dir(self): art = self.ai.art_destination('something.jpg') @@ -893,7 +893,7 @@ class ArtDestinationTest(_common.TestCase): def test_art_path_sanitized(self): config['art_filename'] = u'artXimage' art = self.ai.art_destination('something.jpg') - self.assert_('artYimage' in art) + self.assertTrue('artYimage' in art) class PathStringTest(_common.TestCase): @@ -903,22 +903,22 @@ class PathStringTest(_common.TestCase): self.i = item(self.lib) def test_item_path_is_bytestring(self): - self.assert_(isinstance(self.i.path, bytes)) + self.assertTrue(isinstance(self.i.path, bytes)) def test_fetched_item_path_is_bytestring(self): i = list(self.lib.items())[0] - self.assert_(isinstance(i.path, bytes)) + self.assertTrue(isinstance(i.path, bytes)) def test_unicode_path_becomes_bytestring(self): self.i.path = u'unicodepath' - self.assert_(isinstance(self.i.path, bytes)) + self.assertTrue(isinstance(self.i.path, bytes)) def test_unicode_in_database_becomes_bytestring(self): self.lib._connection().execute(""" update items set path=? where id=? """, (self.i.id, u'somepath')) i = list(self.lib.items())[0] - self.assert_(isinstance(i.path, bytes)) + self.assertTrue(isinstance(i.path, bytes)) def test_special_chars_preserved_in_database(self): path = u'b\xe1r'.encode('utf8') @@ -939,13 +939,13 @@ class PathStringTest(_common.TestCase): def test_destination_returns_bytestring(self): self.i.artist = u'b\xe1r' dest = self.i.destination() - self.assert_(isinstance(dest, bytes)) + self.assertTrue(isinstance(dest, bytes)) def test_art_destination_returns_bytestring(self): self.i.artist = u'b\xe1r' alb = self.lib.add_album([self.i]) dest = alb.art_destination(u'image.jpg') - self.assert_(isinstance(dest, bytes)) + self.assertTrue(isinstance(dest, bytes)) def test_artpath_stores_special_chars(self): path = b'b\xe1r' @@ -958,17 +958,17 @@ class PathStringTest(_common.TestCase): def test_sanitize_path_with_special_chars(self): path = u'b\xe1r?' new_path = util.sanitize_path(path) - self.assert_(new_path.startswith(u'b\xe1r')) + self.assertTrue(new_path.startswith(u'b\xe1r')) def test_sanitize_path_returns_unicode(self): path = u'b\xe1r?' new_path = util.sanitize_path(path) - self.assert_(isinstance(new_path, unicode)) + self.assertTrue(isinstance(new_path, unicode)) def test_unicode_artpath_becomes_bytestring(self): alb = self.lib.add_album([self.i]) alb.artpath = u'somep\xe1th' - self.assert_(isinstance(alb.artpath, bytes)) + self.assertTrue(isinstance(alb.artpath, bytes)) def test_unicode_artpath_in_database_decoded(self): alb = self.lib.add_album([self.i]) @@ -977,7 +977,7 @@ class PathStringTest(_common.TestCase): (u'somep\xe1th', alb.id) ) alb = self.lib.get_album(alb.id) - self.assert_(isinstance(alb.artpath, bytes)) + self.assertTrue(isinstance(alb.artpath, bytes)) class MtimeTest(_common.TestCase):