replace deprecated assert_() with assertTrue()

This commit is contained in:
Johnny Robeson 2016-05-29 03:56:39 -04:00
parent 78387e3f10
commit c330f3abc3
3 changed files with 19 additions and 19 deletions

View file

@ -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')

View file

@ -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

View file

@ -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):