'Test library wide properties'

def test_library_wide_properties(self):

    def to_unicode(x):
        if isinstance(x, bytes):
            return x.decode(u'utf-8')
        if isinstance(x, dict):
            return {(k.decode(u'utf-8') if isinstance(k, bytes) else k): to_unicode(v) for (k, v) in x.iteritems() if (k != u'rec_index')}
        return x
    def get_props(db):
        props = (u'user_version', u'is_second_db', u'library_id', u'custom_column_label_map', u'custom_column_num_map', u'library_path', u'dbpath')
        fprops = (u'last_modified',)
        ans = {x: getattr(db, x) for x in props}
        ans.update({x: getattr(db, x)() for x in fprops})
        ans[u'all_ids'] = frozenset(db.all_ids())
        ans[u'field_metadata'] = fm_as_dict(db.field_metadata)
        return to_unicode(ans)
    old = self.init_old()
    oldvals = get_props(old)
    old.close()
    del old
    db = self.init_legacy()
    newvals = get_props(db)
    self.assertEqual(oldvals, newvals)
    db.close()
