'Test the get_property interface for reading data'

def test_get_property(self):

    def get_values(db):
        ans = {}
        for (label, loc) in db.FIELD_MAP.iteritems():
            if isinstance(label, int):
                label = (u'#' + db.custom_column_num_map[label][u'label'])
            label = type(u'')(label)
            ans[label] = tuple((db.get_property(i, index_is_id=True, loc=loc) for i in db.all_ids()))
            if (label in (u'id', u'title', u'#tags')):
                with self.assertRaises(IndexError):
                    db.get_property(9999, loc=loc)
                with self.assertRaises(IndexError):
                    db.get_property(9999, index_is_id=True, loc=loc)
            if (label in {u'tags', u'formats'}):
                ans[label] = tuple(((set(x.split(u',')) if x else x) for x in ans[label]))
            if (label == u'series_sort'):
                ans[label] = ans[label][1:]
        return ans
    old = self.init_old()
    old_vals = get_values(old)
    old.close()
    old = None
    db = self.init_legacy()
    new_vals = get_values(db)
    db.close()
    self.assertEqual(old_vals, new_vals)
