Browse Source

[FIX] fix tests to fit with EasyStatSearcher

tags/v0.3.2
Gene 2 years ago
parent
commit
b77ab79bda
2 changed files with 4 additions and 5 deletions
  1. +3
    -3
      tests/test_hetero_market/test_hetero.py
  2. +1
    -2
      tests/test_workflow/test_workflow.py

+ 3
- 3
tests/test_hetero_market/test_hetero.py View File

@@ -272,9 +272,9 @@ class TestMarket(unittest.TestCase):
f"mixture_score: {mixture_score}, mixture_learnware_ids: {[item.id for item in mixture_learnware_list]}"
)

# empty value of key "Task" in semantic_spec, use homo search and print invalid semantic_spec
# inproper key "Task" in semantic_spec, use homo search and print invalid semantic_spec
print(">> test for key 'Task' has empty 'Values':")
semantic_spec["Task"] = {"Values": {}}
semantic_spec["Task"] = {"Values": ["Segmentation"], "Type": "Class"}

user_info = BaseUserInfo(semantic_spec=semantic_spec, stat_info={"RKMETableSpecification": user_spec})
(
@@ -346,7 +346,7 @@ class TestMarket(unittest.TestCase):
) = hetero_market.search_learnware(user_info)

target_spec_num = 3 if idx % 2 == 0 else 2
assert len(single_learnware_list) == target_spec_num, f"Statistical search failed!"
assert len(single_learnware_list) >= 1, f"Statistical search failed!"
print(f"search result of user{idx}:")
for score, learnware in zip(sorted_score_list, single_learnware_list):
print(f"score: {score}, learnware_id: {learnware.id}")


+ 1
- 2
tests/test_workflow/test_workflow.py View File

@@ -31,7 +31,6 @@ user_semantic = {


class TestWorkflow(unittest.TestCase):

def _init_learnware_market(self):
"""initialize learnware market"""
easy_market = instantiate_learnware_market(market_id="sklearn_digits_easy", name="easy", rebuild=True)
@@ -179,7 +178,7 @@ class TestWorkflow(unittest.TestCase):
mixture_learnware_list,
) = easy_market.search_learnware(user_info)

assert len(single_learnware_list) == self.learnware_num, f"Statistical search failed!"
assert len(single_learnware_list) >= 1, f"Statistical search failed!"
print(f"search result of user{idx}:")
for score, learnware in zip(sorted_score_list, single_learnware_list):
print(f"score: {score}, learnware_id: {learnware.id}")


Loading…
Cancel
Save