def test_iter1_file(): file = Files("iris") database = DatabaseSlim(file.list_int) sct = database.make_standard_code_table() Files.to_file(sct, "expected_iris_sct") res = slim("iris", 1) Files.to_file(res, "res_test_iter1_iris") print(res)
def test_iter0_file(): file = Files("iris") database = DatabaseSlim(file.list_int) expected = database.make_standard_code_table() res = slim("iris", 0) print(res) assert res == expected
def test_generate_candidate_sct(): db = [[2, 1, 3, 4], [1, 2, 4], [1, 2, 4], [1, 2, 4], [2, 4], [2, 4], [1], [1], [3]] database = DatabaseSlim(db) print(database) standard_code_table = database.make_standard_code_table() # code_table = standard_code_table.copy() res = slimalgo.generate_candidat(standard_code_table, standard_code_table) print(res)
def test_cover_default_sct(): db = [[2, 1, 3, 4], [1, 2, 4], [1, 2, 4], [1, 2, 4], [2, 4], [2, 4], [1], [1], [3]] database = DatabaseSlim(db) print(database) standard_code_table = database.make_standard_code_table() standard_code_table.calcul_usage(database) print(standard_code_table) for e in standard_code_table.patternMap.keys(): print(e.usagelist)
def test_get_support(): db = [[2, 1, 3, 4], [1, 2, 4], [1, 2, 4], [1, 2, 4], [2, 4], [2, 4], [1], [1], [3]] database = DatabaseSlim(db) a = database.get_support(PatternSlim(1)) b = database.get_support(PatternSlim(2)) c = database.get_support(PatternSlim(3)) d = database.get_support(PatternSlim(4)) assert a == 6 assert b == 6 assert c == 2 assert d == 6
def test_cover2_default_sct(): db = [[2, 1, 3, 4], [1, 2, 4], [1, 2, 4], [1, 2, 4], [2, 4], [2, 4], [1], [1], [3]] database = DatabaseSlim(db) print(database) standard_code_table = database.make_standard_code_table() standard_code_table.calcul_usage() code_table = standard_code_table.copy() candidate_list = slimalgo.generate_candidat(code_table, standard_code_table) candidate_list = sorted(candidate_list, key=lambda p: (p.usage), reverse=True) code_table.add(candidate_list[0], None) print("CT") print(code_table) print(">>>>>>>>>>>>>>>>>>>>>>>>") code_table.calcul_usage() print(code_table) print("STANDARD") print(standard_code_table) for e in standard_code_table.patternMap.keys(): print(e.usage_list)
def test_get_support_iris(): file = Files("iris") database = DatabaseSlim(file.list_int) a = database.get_support(PatternSlim(6)) assert a == 67
def test_iter1_file_correct(): file = Files("iris") database = DatabaseSlim(file.list_int) sct = database.make_standard_code_table() res = slim("iris", 1) print(res)