'Test get_metadata() returns the same data for both backends'

def test_get_metadata(self):

    from calibre.library.database2 import LibraryDatabase2
    old = LibraryDatabase2(self.library_path)
    old_metadata = {i: old.get_metadata(i, index_is_id=True, get_cover=True, cover_as_data=True) for i in xrange(1, 4)}
    for mi in old_metadata.itervalues():
        mi.format_metadata = dict(mi.format_metadata)
        if mi.formats:
            mi.formats = tuple(mi.formats)
    old.conn.close()
    old = None
    cache = self.init_cache(self.library_path)
    new_metadata = {i: cache.get_metadata(i, get_cover=True, cover_as_data=True) for i in xrange(1, 4)}
    cache = None
    for (mi2, mi1) in zip(new_metadata.values(), old_metadata.values()):
        self.compare_metadata(mi1, mi2)
