def test_languages(fname): data = open(fname, 'r') print("Testing tree building") languages = lab0.Languages() data_by_year = languages.build_trees_from_file(data) for k in data_by_year.keys(): print( "Tree at year,", k, "Root?", str(data_by_year[k].root._val) + ". Balance is:" + str(data_by_year[k].find_balance_factor(data_by_year[k].root)) + ". Tree is balanced?:", data_by_year[k].is_balanced()) print_paths(data_by_year[k].root) print() print() data.close() query = 'French' data_by_name = languages.query_by_name(query) print("The statistics for English in Canada, by year:") print(data_by_name) data_test = languages.query_by_count(200000) print(data_test) return data_by_year
def test_languages(fname): data = open(fname, 'r') print("Testing tree building") languages = lab0.Languages() data_by_year = languages.build_trees_from_file(data) data.close() query = 21 data_by_name = languages.query_by_count(query) print("The statistics for English in Canada, by year:") print(data_by_name) return data_by_year