fix some tests under PyPy

In PyPy's pure-Python implementation of the sqlite3 module, sqlite3.Row has no
__len__ method. This works around calling len(row).
This commit is contained in:
Adrian Sampson 2012-11-27 21:47:15 -08:00
parent f06c7dfbef
commit c499be05ea

View file

@ -654,7 +654,7 @@ class MigrationTest(unittest.TestCase):
c = new_lib._connection().cursor()
c.execute("select * from items")
row = c.fetchone()
self.assertEqual(len(row), len(self.old_fields))
self.assertEqual(len(row.keys()), len(self.old_fields))
def test_open_with_new_field_adds_column(self):
new_lib = beets.library.Library(self.libfile,
@ -662,7 +662,7 @@ class MigrationTest(unittest.TestCase):
c = new_lib._connection().cursor()
c.execute("select * from items")
row = c.fetchone()
self.assertEqual(len(row), len(self.new_fields))
self.assertEqual(len(row.keys()), len(self.new_fields))
def test_open_with_fewer_fields_leaves_untouched(self):
new_lib = beets.library.Library(self.libfile,
@ -670,7 +670,7 @@ class MigrationTest(unittest.TestCase):
c = new_lib._connection().cursor()
c.execute("select * from items")
row = c.fetchone()
self.assertEqual(len(row), len(self.old_fields))
self.assertEqual(len(row.keys()), len(self.old_fields))
def test_open_with_multiple_new_fields(self):
new_lib = beets.library.Library(self.libfile,
@ -678,7 +678,7 @@ class MigrationTest(unittest.TestCase):
c = new_lib._connection().cursor()
c.execute("select * from items")
row = c.fetchone()
self.assertEqual(len(row), len(self.newer_fields))
self.assertEqual(len(row.keys()), len(self.newer_fields))
def test_open_old_db_adds_album_table(self):
conn = sqlite3.connect(self.libfile)