From 9b054bad2aba8ac1a32ab059a9725f875d799677 Mon Sep 17 00:00:00 2001
From: juga0 <juga@riseup.net>
Date: Wed, 27 Mar 2019 06:15:29 +0000
Subject: [PATCH] fix: tests: Replace str by int

when setting vote and unmeasured Keys.
It doesn't matter here because there're not operations with the
Keys and they're always converted to string in the bandwidth file,
but it less confusing as integer.
---
 sbws/lib/v3bwfile.py            |  4 ++--
 tests/unit/lib/test_v3bwfile.py | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index a4ce7485..89c66ebb 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -626,8 +626,8 @@ class V3BWLine(object):
         # reason.
         # This could be done in a better way as part of a refactor #28684.
 
-        kwargs['vote'] = '0'
-        kwargs['unmeasured'] = '1'
+        kwargs['vote'] = 0
+        kwargs['unmeasured'] = 1
 
         exclusion_reason = None
 
diff --git a/tests/unit/lib/test_v3bwfile.py b/tests/unit/lib/test_v3bwfile.py
index b84a6f4d..720cd4b9 100644
--- a/tests/unit/lib/test_v3bwfile.py
+++ b/tests/unit/lib/test_v3bwfile.py
@@ -267,8 +267,8 @@ def test_from_results_read(datadir, tmpdir, conf, args):
     expected_bwls = V3BWFile.bw_torflow_scale(raw_bwls)
     # Since the scaled lines will be less than the 60% relays in the network,
     # set under_min_report.
-    expected_bwls[0].under_min_report = '1'
-    expected_bwls[0].vote = '0'
+    expected_bwls[0].under_min_report = 1
+    expected_bwls[0].vote = 0
     expected_f = V3BWFile(expected_header, expected_bwls)
     # This way is going to convert bw to KB
     v3bwfile = V3BWFile.from_results(results)
@@ -369,8 +369,8 @@ def test_results_away_each_other(datadir):
     bwl, reason = V3BWLine.from_results(values, secs_away=secs_away, min_num=2)
     assert bwl.relay_recent_measurements_excluded_near_count == 2
     assert reason == 'recent_measurements_excluded_near_count'
-    assert bwl.vote == '0'
-    assert bwl.unmeasured == '1'
+    assert bwl.vote == 0
+    assert bwl.unmeasured == 1
 
     success_results = [r for r in values if isinstance(r, ResultSuccess)]
     assert len(success_results) >= min_num
@@ -391,8 +391,8 @@ def test_results_away_each_other(datadir):
     bwl, reason = V3BWLine.from_results(values, min_num=2)
     assert bwl.relay_recent_measurements_excluded_few_count == 1
     assert reason == 'recent_measurements_excluded_few_count'
-    assert bwl.vote == '0'
-    assert bwl.unmeasured == '1'
+    assert bwl.vote == 0
+    assert bwl.unmeasured == 1
 
     success_results = [r for r in values if isinstance(r, ResultSuccess)]
     assert len(success_results) < min_num
@@ -498,7 +498,7 @@ def test_set_under_min_report(mock_consensus, conf, datadir):
     bwl = v3bwfile.bw_lines[0]
     assert bwl.vote == 0
     assert bwl.under_min_report == 1
-    assert bwl.unmeasured == '1'
+    assert bwl.unmeasured == 1
     assert bwl.bw == 1
 
     # The number of relays after scaling is than the 60% in the network,
-- 
GitLab