def run(self, params={}): orig_ls = params.get("data") if not orig_ls: return {"data": orig_ls, "duplicate_count": 0} new_ls = list(set(orig_ls)) # Get total count of duplicates t_count = util.duplicate_count(orig_ls, new_ls) # Get individual element count e_count = util.element_count(orig_ls) return {"result": new_ls, "duplicate_count": t_count, "element_count": e_count}
def test(self): orig_ls = [1, 2, 3, 1, 2] new_ls = list(set(orig_ls)) # Get total count of duplicates t_count = util.duplicate_count(orig_ls, new_ls) # Get individual element count e_count = util.element_count(orig_ls) if t_count == 2: return {"result": new_ls, "duplicate_count": t_count, "element_count": e_count} self.logger.error("Total count %s from %s is wrong", t_count, orig_ls) raise Exception("Test failed")
def run(self, params={}): orig_ls = params.get('data') if not orig_ls: return {'data': orig_ls, 'duplicate_count': 0} new_ls = list(set(orig_ls)) # Get total count of duplicates t_count = util.duplicate_count(orig_ls, new_ls) # Get individual element count e_count = util.element_count(orig_ls) return { 'result': new_ls, 'duplicate_count': t_count, 'element_count': e_count }
def test(self): orig_ls = [1, 2, 3, 1, 2] new_ls = list(set(orig_ls)) # Get total count of duplicates t_count = util.duplicate_count(orig_ls, new_ls) # Get individual element count e_count = util.element_count(orig_ls) if t_count == 2: return { 'result': new_ls, 'duplicate_count': t_count, 'element_count': e_count } self.logger.error('Total count %s from %s is wrong', t_count, orig_ls) raise Exception('Test failed')