@@ -7,14 +7,14 @@ def test_get_output_row(mocker):
77 get_metrics_mock = mocker .patch ('tokenomics_decentralization.helper.get_metrics' )
88 get_metrics_mock .return_value = ['hhi' , 'gini' ]
99
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 ' )
1111 get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
1212 get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
1313 get_exclude_below_usd_cent_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_usd_cent_flag' )
1414 get_top_limit_type_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_type' )
1515 get_top_limit_value_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_value' )
1616
17- get_no_clustering_mock .return_value = False
17+ get_clustering_mock .return_value = True
1818 get_exclude_contracts_mock .return_value = False
1919 get_exclude_below_fees_mock .return_value = False
2020 get_exclude_below_usd_cent_mock .return_value = False
@@ -23,33 +23,33 @@ def test_get_output_row(mocker):
2323
2424 metrics = {'hhi' : 1 , 'gini' : 0 }
2525 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 ]
2727
28- get_no_clustering_mock .return_value = True
28+ get_clustering_mock .return_value = False
2929 metrics = {'non-clustered hhi' : 1 , 'non-clustered gini' : 0 }
3030 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 ]
3232
3333 get_exclude_contracts_mock .return_value = True
3434 metrics = {'exclude_contracts non-clustered hhi' : 1 , 'exclude_contracts non-clustered gini' : 0 }
3535 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 ]
3737
3838 get_top_limit_value_mock .return_value = 1
3939 metrics = {'top-1_absolute exclude_contracts non-clustered hhi' : 1 , 'top-1_absolute exclude_contracts non-clustered gini' : 0 }
4040 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 ]
4242
4343 get_exclude_below_fees_mock .return_value = True
4444 get_top_limit_value_mock .return_value = 1
4545 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 }
4646 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 ]
4848
4949
5050def test_analyze_snapshot (mocker ):
5151 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 ' )
5353 get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
5454 get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
5555 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):
6868 compute_tau_mock = mocker .patch ('tokenomics_decentralization.analyze.compute_tau' )
6969
7070 get_force_analyze_mock .return_value = False
71- get_no_clustering_mock .return_value = False
71+ get_clustering_mock .return_value = True
7272 get_exclude_contracts_mock .return_value = False
7373 get_exclude_below_fees_mock .return_value = False
7474 get_exclude_below_usd_cent_mock .return_value = False
@@ -85,7 +85,7 @@ def test_analyze_snapshot(mocker):
8585 output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
8686 assert output == {'hhi' : 1 }
8787
88- get_no_clustering_mock .return_value = True
88+ get_clustering_mock .return_value = False
8989 get_exclude_contracts_mock .return_value = True
9090 get_exclude_below_fees_mock .return_value = True
9191 get_top_limit_type_mock .return_value = 'absolute'
@@ -106,7 +106,7 @@ def test_analyze_snapshot(mocker):
106106 output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
107107 assert output == {'top-1_absolute exclude_below_fees exclude_contracts non-clustered hhi' : 2 }
108108
109- get_no_clustering_mock .return_value = False
109+ get_clustering_mock .return_value = True
110110
111111 compute_hhi_mock .return_value = 3
112112 output = analyze_snapshot (None , 'bitcoin' , '2010-01-01' )
@@ -140,36 +140,36 @@ def test_write_csv_output(mocker):
140140 get_output_directories_mock = mocker .patch ('tokenomics_decentralization.helper.get_output_directories' )
141141 get_output_directories_mock .return_value = [pathlib .Path (__file__ ).resolve ().parent ]
142142
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 ' )
144144 get_exclude_contracts_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_contracts_flag' )
145145 get_exclude_below_fees_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_fees_flag' )
146146 get_exclude_below_usd_cent_mock = mocker .patch ('tokenomics_decentralization.helper.get_exclude_below_usd_cent_flag' )
147147 get_top_limit_type_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_type' )
148148 get_top_limit_value_mock = mocker .patch ('tokenomics_decentralization.helper.get_top_limit_value' )
149149
150- get_no_clustering_mock .return_value = False
150+ get_clustering_mock .return_value = True
151151 get_exclude_contracts_mock .return_value = False
152152 get_exclude_below_fees_mock .return_value = False
153153 get_exclude_below_usd_cent_mock .return_value = False
154154 get_top_limit_type_mock .return_value = 'absolute'
155155 get_top_limit_value_mock .return_value = 0
156156
157157 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 ],
160160 ])
161161 with open (pathlib .Path (__file__ ).resolve ().parent / 'output.csv' ) as f :
162162 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' ,
164164 'top_limit_type' , 'top_limit_value' , 'exclude_below_fees' ,
165165 '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' ,
167167 '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' ,
169169 '200' ]) + '\n '
170170 os .remove (pathlib .Path (__file__ ).resolve ().parent / 'output.csv' )
171171
172- get_no_clustering_mock .return_value = True
172+ get_clustering_mock .return_value = False
173173 get_exclude_contracts_mock .return_value = True
174174 get_exclude_below_fees_mock .return_value = True
175175 get_top_limit_type_mock .return_value = 'absolute'
@@ -181,7 +181,7 @@ def test_write_csv_output(mocker):
181181 ])
182182 with open (pathlib .Path (__file__ ).resolve ().parent / 'output-no_clustering-exclude_contract_addresses-absolute_10-exclude_below_fees.csv' ) as f :
183183 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' ,
185185 'top_limit_type' , 'top_limit_value' , 'exclude_below_fees' ,
186186 'exclude_below_usd_cent' , 'hhi' ]) + '\n '
187187 assert lines [1 ] == ',' .join (['bitcoin' , '2010-01-01' , 'False' , 'False' , 'absolute' , '0' , 'False' , 'False' ,
0 commit comments