Skip to content
Snippets Groups Projects
Commit 197e5451 authored by Pierre LALET's avatar Pierre LALET
Browse files

Rename argument set -> values; replace filter + lambda by comprehension

parent 2e1e7e10
No related branches found
No related tags found
No related merge requests found
...@@ -138,15 +138,15 @@ class TestCampaign(TestClass): ...@@ -138,15 +138,15 @@ class TestCampaign(TestClass):
class TestSet(TestClass): class TestSet(TestClass):
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.set = [] self.tests = []
self.comments = "" self.comments = ""
self.keywords = [] self.keywords = []
self.crc = None self.crc = None
self.expand = 1 self.expand = 1
def add_test(self, test): def add_test(self, test):
self.set.append(test) self.tests.append(test)
def __iter__(self): def __iter__(self):
return self.set.__iter__() return self.tests.__iter__()
class UnitTest(TestClass): class UnitTest(TestClass):
def __init__(self, name): def __init__(self, name):
...@@ -257,8 +257,9 @@ def compute_campaign_digests(test_campaign): ...@@ -257,8 +257,9 @@ def compute_campaign_digests(test_campaign):
def filter_tests_on_numbers(test_campaign, num): def filter_tests_on_numbers(test_campaign, num):
if num: if num:
for ts in test_campaign: for ts in test_campaign:
ts.set = filter(lambda t: t.num in num, ts.set) ts.tests = [t for t in ts.tests if t.num in num]
test_campaign.campaign = filter(lambda ts: len(ts.set) > 0, test_campaign.campaign) test_campaign.campaign = [ts for ts in test_campaign.campaign
if ts.tests]
def filter_tests_keep_on_keywords(test_campaign, kw): def filter_tests_keep_on_keywords(test_campaign, kw):
def kw_match(lst, kw): def kw_match(lst, kw):
...@@ -269,7 +270,7 @@ def filter_tests_keep_on_keywords(test_campaign, kw): ...@@ -269,7 +270,7 @@ def filter_tests_keep_on_keywords(test_campaign, kw):
if kw: if kw:
for ts in test_campaign: for ts in test_campaign:
ts.set = filter(lambda t: kw_match(t.keywords, kw), ts.set) ts.tests = [t for t in ts.tests if kw_match(t.keywords, kw)]
def filter_tests_remove_on_keywords(test_campaign, kw): def filter_tests_remove_on_keywords(test_campaign, kw):
def kw_match(lst, kw): def kw_match(lst, kw):
...@@ -280,11 +281,11 @@ def filter_tests_remove_on_keywords(test_campaign, kw): ...@@ -280,11 +281,11 @@ def filter_tests_remove_on_keywords(test_campaign, kw):
if kw: if kw:
for ts in test_campaign: for ts in test_campaign:
ts.set = filter(lambda t: not kw_match(t.keywords, kw), ts.set) ts.tests = [t for t in ts.tests if not kw_match(t.keywords, kw)]
def remove_empty_testsets(test_campaign): def remove_empty_testsets(test_campaign):
test_campaign.campaign = filter(lambda ts: len(ts.set) > 0, test_campaign.campaign) test_campaign.campaign = [ts for ts in test_campaign.campaign if ts.tests]
#### RUN CAMPAIGN ##### #### RUN CAMPAIGN #####
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment