Browse Source

[FIX] fix bug s in test_workflow

tags/v0.3.2
bxdd 2 years ago
parent
commit
4e66754de7
3 changed files with 5 additions and 13 deletions
  1. +1
    -1
      learnware/market/easy2/organizer.py
  2. +3
    -11
      tests/test_market/test_easy.py
  3. +1
    -1
      tests/test_workflow/test_workflow.py

+ 1
- 1
learnware/market/easy2/organizer.py View File

@@ -337,7 +337,7 @@ class EasyOrganizer(BaseOrganizer):
Learnware ids
"""
if check_status is None:
filtered_ids = self.use_flags.keys()
filtered_ids = list(self.use_flags.keys())
elif check_status in [BaseChecker.NONUSABLE_LEARNWARE, BaseChecker.USABLE_LEARWARE]:
filtered_ids = [key for key, value in self.use_flags.items() if value == check_status]
else:


+ 3
- 11
tests/test_market/test_easy.py View File

@@ -27,15 +27,6 @@ user_semantic = {
"Scenario": {"Values": ["Education"], "Type": "Tag"},
"Description": {"Values": "", "Type": "String"},
"Name": {"Values": "", "Type": "String"},
"Input": {
},
"Output": {
"Dimension": 10,
"Description": {
"0": "the probability of the label is zero",
},
},
}


@@ -47,7 +38,7 @@ class TestMarket(unittest.TestCase):

def _init_learnware_market(self):
"""initialize learnware market"""
easy_market = instantiate_learnware_market(market_id="sklearn_digits", name="easy", rebuild=True)
easy_market = instantiate_learnware_market(market_id="sklearn_digits_easy", name="easy", rebuild=True)
return easy_market

def test_prepare_learnware_randomly(self, learnware_num=5):
@@ -107,7 +98,8 @@ class TestMarket(unittest.TestCase):
semantic_spec = copy.deepcopy(user_semantic)
semantic_spec["Name"]["Values"] = "learnware_%d" % (idx)
semantic_spec["Description"]["Values"] = "test_learnware_number_%d" % (idx)
semantic_spec["Output"] = {"Dimension": 1, "Description": {"0": "The label of the hand-written digit."}}
semantic_spec["Input"] = {"Dimension": 64, "Description": {f"{i}": f"The value in the grid {i // 8}{i % 8} of the image of hand-written digit." for i in range(64)}}
semantic_spec["Output"] = {"Dimension": 10, "Description": {f"{i}": "The probability for each digit for 0 to 9." for i in range(10)}}
easy_market.add_learnware(zip_path, semantic_spec)

print("Total Item:", len(easy_market))


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

@@ -96,7 +96,7 @@ class TestAllWorkflow(unittest.TestCase):
semantic_spec = copy.deepcopy(user_semantic)
semantic_spec["Name"]["Values"] = "learnware_%d" % (idx)
semantic_spec["Description"]["Values"] = "test_learnware_number_%d" % (idx)
semantic_spec["Output"] = {"Dimension": 1, "Description": {"0": "The label of the hand-written digit."}}
semantic_spec["Output"] = {"Dimension": 10, "Description": {f"{i}": "The probability for each digit for 0 to 9." for i in range(10)}}
easy_market.add_learnware(zip_path, semantic_spec)

print("Total Item:", len(easy_market))


Loading…
Cancel
Save