<s> """<STR_LIT>""" <EOL> import unittest <EOL> from pyproct . clustering . cluster import Cluster <EOL> from pyproct . clustering . clustering import Clustering <EOL> from pyproct . clustering . evaluation . analysis . analysisPopulator import AnalysisPopulator <EOL> class AnalysisPopulatorMock ( AnalysisPopulator ) : <EOL> def __init__ ( self , parameters ) : <EOL> AnalysisPopulator . __init__ ( self , "<STR_LIT>" , "<STR_LIT>" , parameters ) <EOL> def build_all_analysis ( self , one , two ) : <EOL> self . all_possible_analysis = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> class ClusteringMock ( object ) : <EOL> def __init__ ( self , number_of_clusters , number_of_elements ) : <EOL> self . number_of_clusters = number_of_clusters <EOL> self . total_number_of_elements = number_of_elements <EOL> self . clusters = range ( number_of_clusters ) <EOL> self . details = "<STR_LIT>" <EOL> def sort_clusters_by_size ( self ) : <EOL> pass <EOL> def get_population_percent_of_cluster ( self , i ) : <EOL> return self . clusters [ i ] <EOL> def get_population_percent_of_n_bigger_clusters ( self , n ) : <EOL> return [ <NUM_LIT> , <NUM_LIT:20> , <NUM_LIT:10> , <NUM_LIT:5> ] <EOL> class TestAnalysisPopulator ( unittest . TestCase ) : <EOL> def test_get_query_and_evaluation_analysis_types ( self ) : <EOL> parameters = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT:0.1> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT> <EOL> } <EOL> } <EOL> } , <EOL> "<STR_LIT>" : [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> } <EOL> } <EOL> } <EOL> self . assertItemsEqual ( AnalysisPopulator . get_evaluation_analysis_types ( parameters ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . assertItemsEqual ( AnalysisPopulator . get_query_and_evaluation_analysis_types ( parameters ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_populate_analyzer ( self ) : <EOL> queue = AnalysisPopulatorMock ( { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT:0.1> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT:action>" : "<STR_LIT:>>" , <EOL> "<STR_LIT>" : <NUM_LIT> <EOL> } <EOL> } <EOL> } , <EOL> "<STR_LIT>" : [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> } <EOL> } <EOL> } ) . get_analysis_list ( ) <EOL> self . assertItemsEqual ( queue , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> def test_num_clusters ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEquals ( <NUM_LIT:5> , analysisPopulator . analysis_function_num_clusters ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT:1000> ) ) ) <EOL> def test_total_elems ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEquals ( <NUM_LIT:1000> , analysisPopulator . analysis_function_total_elements ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT:1000> ) ) ) <EOL> def test_top_4 ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , analysisPopulator . analysis_function_top_4 ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT:1000> ) ) ) <EOL> def test_top_percent ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT:0> , analysisPopulator . analysis_function_top_percent ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT:1000> ) ) ) <EOL> def test_details ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEqual ( "<STR_LIT>" , analysisPopulator . analysis_function_details ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT:1000> ) ) ) <EOL> def test_noise_level ( self ) : <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , analysisPopulator . analysis_function_noise_level ( ClusteringMock ( <NUM_LIT:5> , <NUM_LIT> ) , <NUM_LIT:1000> ) ) <EOL> def test_mean_cluster_size ( self ) : <EOL> clusters = [ Cluster ( <NUM_LIT:0> , [ <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT> ] ) , <EOL> Cluster ( <NUM_LIT:1> , [ <NUM_LIT:1> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> ] ) , <EOL> Cluster ( <NUM_LIT:2> , [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT> ] ) , <EOL> Cluster ( <NUM_LIT:6> , [ <NUM_LIT:6> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT:15> ] ) , <EOL> Cluster ( <NUM_LIT:9> , [ <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT> ] ) ] <EOL> clustering = Clustering ( clusters , "<STR_LIT>" ) <EOL> analysisPopulator = AnalysisPopulatorMock ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT:4> , analysisPopulator . analysis_function_mean_cluster_size ( clustering ) ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
