def _test_precision(self, (tabname, sql), diff, values, attr):

        try:
            c = self.cursor()
            try:
                c.execute("drop table %s" % (tabname))
                self.db.commit()
            except:
                self.db.rollback()
        finally:
            c.close()

        try:
            c = self.cursor()
            c.execute(sql)
            c.execute((tabname) % "insert into %s (a, b) values (?, ?)", map(lambda x: (0, x), values))
            c.execute("select a, b from %s" % (tabname))
            f = c.fetchall()
            assert len(values) == len(f), "mismatched result set length"
            for i in range(0, len(f)):
                v = values[i]
                if attr: v = getattr(v, attr)()
                msg = "expected [%0.10f], got [%0.10f] for index [%d] of [%d]" % (v, f[i][1], (i+1), len(f))
                assert diff(f[i][1], values[i]) < 0.01, msg
            self.db.commit()
        finally:
            c.close()
            try:
                c = self.cursor()
                try:
                    c.execute("drop table %s" % (tabname))
                    self.db.commit()
                except:
                    self.db.rollback()
            finally:
                c.close()
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/zxjdbc/zxtest.py/zxAPITestCase._test_precision/swapped operands of `%`