Commit c57ba63e authored by juga  's avatar juga
Browse files

generate: use round_digs variable name in methods

The torflow-round-digs cli argument was kept, but it was added
other argument, round-digs, for the same option.
argparse takes the first argument as the variable name, but the
methods where still using torflow_round_digs.

Closes bug #28602. Bugfix 1.0.3-dev0.
parent a47777cc
......@@ -106,7 +106,7 @@ def main(args, conf):
bw_file = V3BWFile.from_results(results, state_fpath, args.scale_constant,
scaling_method,
torflow_cap=args.torflow_bw_margin,
torflow_round_digs=args.torflow_round_digs,
round_digs=args.round_digs,
secs_recent=args.secs_recent,
secs_away=args.secs_away,
min_num=args.min_num,
......
......@@ -488,7 +488,7 @@ class V3BWFile(object):
scaling_method=TORFLOW_SCALING,
torflow_obs=TORFLOW_OBS_LAST,
torflow_cap=TORFLOW_BW_MARGIN,
torflow_round_digs=PROP276_ROUND_DIG,
round_digs=PROP276_ROUND_DIG,
secs_recent=None, secs_away=None, min_num=0,
consensus_path=None, max_bw_diff_perc=MAX_BW_DIFF_PERC,
reverse=False):
......@@ -533,7 +533,7 @@ class V3BWFile(object):
# log.debug(bw_lines[-1])
elif scaling_method == TORFLOW_SCALING:
bw_lines = cls.bw_torflow_scale(bw_lines_raw, torflow_obs,
torflow_cap, torflow_round_digs)
torflow_cap, round_digs)
# log.debug(bw_lines[-1])
cls.update_progress(
cls, bw_lines, header, number_consensus_relays, state)
......
......@@ -6,7 +6,7 @@ import os.path
from sbws import __version__ as version
from sbws.globals import (SPEC_VERSION, SBWS_SCALING, TORFLOW_SCALING,
MIN_REPORT)
MIN_REPORT, TORFLOW_ROUND_DIG, PROP276_ROUND_DIG)
from sbws.lib.resultdump import Result, load_result_file, ResultSuccess
from sbws.lib.v3bwfile import (V3BWHeader, V3BWLine, TERMINATOR, LINE_SEP,
KEYVALUE_SEP_V1, num_results_of_type,
......@@ -266,14 +266,21 @@ def test_sbws_scale(datadir):
def test_torflow_scale(datadir):
results = load_result_file(str(datadir.join("results.txt")))
v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING)
assert v3bwfile.bw_lines[0].bw == 520
v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING,
torflow_cap=0.0001)
assert v3bwfile.bw_lines[0].bw == 520
round_digs=TORFLOW_ROUND_DIG)
assert v3bwfile.bw_lines[0].bw == 524
v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING,
torflow_cap=0.0001,
round_digs=TORFLOW_ROUND_DIG)
assert v3bwfile.bw_lines[0].bw == 524
v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING,
torflow_cap=1, torflow_round_digs=1)
assert v3bwfile.bw_lines[0].bw == 500
torflow_cap=1,
round_digs=TORFLOW_ROUND_DIG)
assert v3bwfile.bw_lines[0].bw == 524
v3bwfile = V3BWFile.from_results(results, scaling_method=TORFLOW_SCALING,
torflow_cap=1,
round_digs=PROP276_ROUND_DIG)
assert v3bwfile.bw_lines[0].bw == 520
def test_results_away_each_other(datadir):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment