Exemple #1
0
 def test_lookup_5(self):
     result = lookup(self.data,
                     lookup_map={i: i
                                 for i in self.even},
                     merge=True)
     expected = {0: 0, 2: 2, 4: 4}
     self.assertDictEqual(dict(result), expected)
Exemple #2
0
 def test_lookup_1(self):
     result, rejects = lookup(self.data,
                              lookup_map={i: i
                                          for i in self.even},
                              enable_rejects=True)
     self.assertListEqual(list(result), self.even)
     self.assertListEqual(list(rejects), [1, 3])
Exemple #3
0
 def test_lookup_4(self):
     result = lookup(
         self.data,
         lookup_map={i: i
                     for i in self.even},
         merge=lambda v, m: (v, m == v),
     )
     expected = {0: True, 2: True, 4: True}
     self.assertDictEqual(dict(result), expected)
Exemple #4
0
 def test_lookup_3(self):
     result, rejects = lookup(self.data, enable_rejects=True)
     self.assertListEqual(list(result), [])
     self.assertListEqual(list(rejects), self.data)
Exemple #5
0
 def test_lookup_2(self):
     result = lookup(self.data)
     self.assertListEqual(list(result), [])
Exemple #6
0
 def test_lookup_0(self):
     result = lookup(self.data,
                     lookup_map={i: i
                                 for i in self.even},
                     enable_rejects=False)
     self.assertListEqual(list(result), self.even)