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

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        set_attrs_from_dict = lambda i,d,l: \
    [setattr(i, k, v) for k,v in d.iteritems() if k in l]
        


src/l/i/list115utils-1.0.1/list115utils/test/test_listutils.py   list115utils(Download)
        self.assertSequenceEqual(tuplify([1,2,3], n=4), [(1,2,3), ])
 
from list115utils import set_attrs_from_dict
class TestSetAttrsFromDict(TestListUtils):
    def setUp(self):
    def test_set_attrs_from_dict_returns_correct_set(self):
        set_attrs_from_dict(self.obj, self.test_dict, ['a', 'c'])
        self.assertEqual(self.obj.a, 1)
        self.assertEqual(self.obj.c, 3)