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

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

        subdict = lambda d,l: \
    {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.assertEqual(which(p_true, self.items), 0)
 
from list115utils import subdict
class TestSubdict(TestListUtils):
    def setUp(self):
        self.test_dict = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6}
 
    def test_subdict_returns_the_right_dictionary(self):
        self.assertDictEqual(
                subdict(self.test_dict, 'ace'), 
    def test_subdict_returns_only_present_items(self):
        self.assertDictEqual(subdict(self.test_dict, 'dof'), {'d':4, 'f':6})
 
    def test_subdict_returns_empty_dict_if_no_match(self):
        self.assertDictEqual(subdict(self.test_dict, 'gut'), {})