from lib.utils import exact_round from model import Model def test_db_round(val, exp): """ test_db_round :return: """ sql = "SELECT round({}, {}) as val".format(str(val), exp) db_round = Model().raw(sql)[0]["val"] exa_round = exact_round(val, exp) if str(db_round) != str(exa_round): print "db:{}; ex:{}".format(str(db_round), str(exa_round)) if __name__ == "__main__": val = 900.0000 while val < 1001.8600: for exp in range(0, 6): test_db_round(val, exp=exp) val += 0.0005
alias cnpm="npm --registry=https://registry.npm.taobao.org \ --cache=$HOME/.npm/.cache/cnpm \ --disturl=https://npm.taobao.org/dist \ --userconfig=$HOME/.cnpmrc"
# Or alias it in .bashrc or .zshrc $ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \ --cache=$HOME/.npm/.cache/cnpm \ --disturl=https://npm.taobao.org/dist \ --userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc