@@ -7,14 +7,14 @@ def test_get_output_row(mocker):
7
7
get_metrics_mock = mocker .patch ('tokenomics_decentralization.helper.get_metrics' )
8
8
get_metrics_mock .return_value = ['hhi' , 'gini' ]
9
9
10
- get_no_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_no_clustering_flag ' )
10
+ get_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_clustering_flag ' )
11
11
get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
12
12
get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
13
13
get_exclude_below_usd_cent_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_usd_cent_flag' )
14
14
get_top_limit_type_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_type' )
15
15
get_top_limit_value_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_value' )
16
16
17
- get_no_clustering_mock .return_value = False
17
+ get_clustering_mock .return_value = True
18
18
get_exclude_contracts_mock .return_value = False
19
19
get_exclude_below_fees_mock .return_value = False
20
20
get_exclude_below_usd_cent_mock .return_value = False
@@ -23,33 +23,33 @@ def test_get_output_row(mocker):
23
23
24
24
metrics = {'hhi' : 1 , 'gini' : 0 }
25
25
csv_row = get_output_row ('bitcoin' , '2010-01-01' , metrics )
26
- assert csv_row == ['bitcoin' , '2010-01-01' , False , False , 'absolute' , 0 , False , False , 1 , 0 ]
26
+ assert csv_row == ['bitcoin' , '2010-01-01' , True , False , 'absolute' , 0 , False , False , 1 , 0 ]
27
27
28
- get_no_clustering_mock .return_value = True
28
+ get_clustering_mock .return_value = False
29
29
metrics = {'non-clustered hhi' : 1 , 'non-clustered gini' : 0 }
30
30
csv_row = get_output_row ('bitcoin' , '2010-01-01' , metrics )
31
- assert csv_row == ['bitcoin' , '2010-01-01' , True , False , 'absolute' , 0 , False , False , 1 , 0 ]
31
+ assert csv_row == ['bitcoin' , '2010-01-01' , False , False , 'absolute' , 0 , False , False , 1 , 0 ]
32
32
33
33
get_exclude_contracts_mock .return_value = True
34
34
metrics = {'exclude_contracts non-clustered hhi' : 1 , 'exclude_contracts non-clustered gini' : 0 }
35
35
csv_row = get_output_row ('bitcoin' , '2010-01-01' , metrics )
36
- assert csv_row == ['bitcoin' , '2010-01-01' , True , True , 'absolute' , 0 , False , False , 1 , 0 ]
36
+ assert csv_row == ['bitcoin' , '2010-01-01' , False , True , 'absolute' , 0 , False , False , 1 , 0 ]
37
37
38
38
get_top_limit_value_mock .return_value = 1
39
39
metrics = {'top-1_absolute exclude_contracts non-clustered hhi' : 1 , 'top-1_absolute exclude_contracts non-clustered gini' : 0 }
40
40
csv_row = get_output_row ('bitcoin' , '2010-01-01' , metrics )
41
- assert csv_row == ['bitcoin' , '2010-01-01' , True , True , 'absolute' , 1 , False , False , 1 , 0 ]
41
+ assert csv_row == ['bitcoin' , '2010-01-01' , False , True , 'absolute' , 1 , False , False , 1 , 0 ]
42
42
43
43
get_exclude_below_fees_mock .return_value = True
44
44
get_top_limit_value_mock .return_value = 1
45
45
metrics = {'top-1_absolute exclude_below_fees exclude_contracts non-clustered hhi' : 1 , 'top-1_absolute exclude_below_fees exclude_contracts non-clustered gini' : 0 }
46
46
csv_row = get_output_row ('bitcoin' , '2010-01-01' , metrics )
47
- assert csv_row == ['bitcoin' , '2010-01-01' , True , True , 'absolute' , 1 , True , False , 1 , 0 ]
47
+ assert csv_row == ['bitcoin' , '2010-01-01' , False , True , 'absolute' , 1 , True , False , 1 , 0 ]
48
48
49
49
50
50
def test_analyze_snapshot (mocker ):
51
51
get_force_analyze_mock = mocker .patch ('tokenomics_decentralization.helper.get_force_analyze_flag' )
52
- get_no_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_no_clustering_flag ' )
52
+ get_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_clustering_flag ' )
53
53
get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
54
54
get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
55
55
get_exclude_below_usd_cent_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_usd_cent_flag' )
@@ -68,7 +68,7 @@ def test_analyze_snapshot(mocker):
68
68
compute_tau_mock = mocker .patch ('tokenomics_decentralization.analyze.compute_tau' )
69
69
70
70
get_force_analyze_mock .return_value = False
71
- get_no_clustering_mock .return_value = False
71
+ get_clustering_mock .return_value = True
72
72
get_exclude_contracts_mock .return_value = False
73
73
get_exclude_below_fees_mock .return_value = False
74
74
get_exclude_below_usd_cent_mock .return_value = False
@@ -85,7 +85,7 @@ def test_analyze_snapshot(mocker):
85
85
output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
86
86
assert output == {'hhi' : 1 }
87
87
88
- get_no_clustering_mock .return_value = True
88
+ get_clustering_mock .return_value = False
89
89
get_exclude_contracts_mock .return_value = True
90
90
get_exclude_below_fees_mock .return_value = True
91
91
get_top_limit_type_mock .return_value = 'absolute'
@@ -106,7 +106,7 @@ def test_analyze_snapshot(mocker):
106
106
output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
107
107
assert output == {'top-1_absolute exclude_below_fees exclude_contracts non-clustered hhi' : 2 }
108
108
109
- get_no_clustering_mock .return_value = False
109
+ get_clustering_mock .return_value = True
110
110
111
111
compute_hhi_mock .return_value = 3
112
112
output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
@@ -140,36 +140,36 @@ def test_write_csv_output(mocker):
140
140
get_output_directories_mock = mocker .patch ('tokenomics_decentralization.helper.get_output_directories' )
141
141
get_output_directories_mock .return_value = [pathlib .Path (__file__ ).resolve ().parent ]
142
142
143
- get_no_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_no_clustering_flag ' )
143
+ get_clustering_mock = mocker .patch ('tokenomics_decentralization.helper.get_clustering_flag ' )
144
144
get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
145
145
get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
146
146
get_exclude_below_usd_cent_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_usd_cent_flag' )
147
147
get_top_limit_type_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_type' )
148
148
get_top_limit_value_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_value' )
149
149
150
- get_no_clustering_mock .return_value = False
150
+ get_clustering_mock .return_value = True
151
151
get_exclude_contracts_mock .return_value = False
152
152
get_exclude_below_fees_mock .return_value = False
153
153
get_exclude_below_usd_cent_mock .return_value = False
154
154
get_top_limit_type_mock .return_value = 'absolute'
155
155
get_top_limit_value_mock .return_value = 0
156
156
157
157
write_csv_output ([
158
- ['bitcoin' , '2010-01-01' , False , False , 'absolute' , 0 , False , False , 100 ],
159
- ['ethereum' , '2010-01-01' , False , False , 'absolute' , 0 , False , False , 200 ],
158
+ ['bitcoin' , '2010-01-01' , True , False , 'absolute' , 0 , False , False , 100 ],
159
+ ['ethereum' , '2010-01-01' , True , False , 'absolute' , 0 , False , False , 200 ],
160
160
])
161
161
with open (pathlib .Path (__file__ ).resolve ().parent / 'output.csv' ) as f :
162
162
lines = f .readlines ()
163
- assert lines [0 ] == ',' .join (['ledger' , 'snapshot date ' , 'no_clustering ' , 'exclude_contract_addresses' ,
163
+ assert lines [0 ] == ',' .join (['ledger' , 'snapshot_date ' , 'clustering ' , 'exclude_contract_addresses' ,
164
164
'top_limit_type' , 'top_limit_value' , 'exclude_below_fees' ,
165
165
'exclude_below_usd_cent' , 'hhi' ]) + '\n '
166
- assert lines [1 ] == ',' .join (['bitcoin' , '2010-01-01' , 'False ' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
166
+ assert lines [1 ] == ',' .join (['bitcoin' , '2010-01-01' , 'True ' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
167
167
'100' ]) + '\n '
168
- assert lines [2 ] == ',' .join (['ethereum' , '2010-01-01' , 'False ' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
168
+ assert lines [2 ] == ',' .join (['ethereum' , '2010-01-01' , 'True ' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
169
169
'200' ]) + '\n '
170
170
os .remove (pathlib .Path (__file__ ).resolve ().parent / 'output.csv' )
171
171
172
- get_no_clustering_mock .return_value = True
172
+ get_clustering_mock .return_value = False
173
173
get_exclude_contracts_mock .return_value = True
174
174
get_exclude_below_fees_mock .return_value = True
175
175
get_top_limit_type_mock .return_value = 'absolute'
@@ -181,7 +181,7 @@ def test_write_csv_output(mocker):
181
181
])
182
182
with open (pathlib .Path (__file__ ).resolve ().parent / 'output-no_clustering-exclude_contract_addresses-absolute_10-exclude_below_fees.csv' ) as f :
183
183
lines = f .readlines ()
184
- assert lines [0 ] == ',' .join (['ledger' , 'snapshot date ' , 'no_clustering ' , 'exclude_contract_addresses' ,
184
+ assert lines [0 ] == ',' .join (['ledger' , 'snapshot_date ' , 'clustering ' , 'exclude_contract_addresses' ,
185
185
'top_limit_type' , 'top_limit_value' , 'exclude_below_fees' ,
186
186
'exclude_below_usd_cent' , 'hhi' ]) + '\n '
187
187
assert lines [1 ] == ',' .join (['bitcoin' , '2010-01-01' , 'False' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
0 commit comments