Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

        remove_if = lambda f, l: filter(lambda x: not(f(x)), l)
        


src/l/i/list115utils-1.0.1/list115utils/test/test_listutils.py   list115utils(Download)
        self.assertEqual(compose(f_dbl, f_inc)(5), (5+1)*2)
 
from list115utils import remove_if
class TestRemoveIf(TestListUtils):
    def test_remove_if_removes_even_elements(self):
        self.assertEqual(remove_if(p_even, self.simple_list), [1,3,5])
 
    def test_remove_if_removes_odd_elements(self):
        self.assertEqual(remove_if(p_odd, self.simple_list), [2,4,6])
    def test_remove_if_doesnt_remove_unmatching_elements(self):
        self.assertEqual(remove_if(p_even, [1,3]), [1,3])
 
    def test_remove_if_works_on_empty_lists(self):
        self.assertEqual(remove_if(p_odd, []), [])