예제 #1
0
 def test_otracker_get_objects(self):
     """Test object tracker."""
     otracker = tracker.ObjectTracker()
     o = self._get_indicator()
     # indicator object should be in result set
     res = compat.object_in_list(o, otracker._get_objects())
     self.assertTrue(res)
     # indicator object should not be in result set
     res = compat.object_in_list(o, otracker._get_objects(ignore=[o]))
     self.assertFalse(res)
예제 #2
0
 def test_otracker_get_objects(self):
     """Test object tracker."""
     otracker = tracker.ObjectTracker()
     o = self._get_indicator()
     # indicator object should be in result set
     res = compat.object_in_list(o, otracker._get_objects())
     self.assertTrue(res)
     # indicator object should not be in result set
     res = compat.object_in_list(o, otracker._get_objects(ignore=(o,)))
     self.assertFalse(res)
예제 #3
0
 def get_not_included(foo, bar):
     """Compare objects from foo with objects defined in the values of
     bar (set of partitions).
     Returns a list of all objects included in list, but not dict values.
     """
     res = []
     for o in foo:
         if not compat.object_in_list(type(o), bar):
             res.append(o)
         elif not compat.object_in_list(o, bar[type(o)]):
             res.append(o)
     return res
예제 #4
0
 def get_not_included(foo, bar):
     """Compare objects from foo with objects defined in the values of
     bar (set of partitions).
     Returns a list of all objects included in list, but not dict values.
     """
     res = []
     for o in foo:
         if not compat.object_in_list(type(o), bar):
             res.append(o)
         elif not compat.object_in_list(o, bar[type(o)]):
             res.append(o)
     return res
예제 #5
0
 def remove_ignore(objects, ignore=[]):
     # remove all objects listed in the ignore list
     res = []
     for o in objects:
         if not compat.object_in_list(o, ignore):
             res.append(o)
     return res
예제 #6
0
 def remove_ignore(objects, ignore=[]):
     # remove all objects listed in the ignore list
     res = []
     for o in objects:
         if not compat.object_in_list(o, ignore):
             res.append(o)
     return res