Пример #1
0
def test_and_argegarion(all_values):
    for values1 in [{'guid_0', 'guid_1'}, {'guid_3', 'guid_6', 'guid_20'},
                    {'guid_2'}]:
        for values2 in [{'guid_2', 'guid_1'}, {'guid_5', 'guid_9'},
                        {'guid_2'}]:
            test_predicate = in_reduce([
                in_set(values1, 'volume_guid'),
                in_set(values2, 'volume_guid')
            ], all)
            included_values = set()
            for val in all_values:
                if test_predicate.do_include({'volume_guid': val}):
                    included_values.add(val)
            assert included_values == values1.intersection(values2)
Пример #2
0
 def test_or_argegarion(self):
     for values1 in [{'guid_0', 'guid_1'}, {'guid_3', 'guid_6', 'guid_20'},
                     {'guid_2'}]:
         for values2 in [{'guid_2', 'guid_1'}, {'guid_5', 'guid_9'},
                         {'guid_2'}]:
             test_predicate = in_reduce([
                 in_set(values1, 'volume_guid'),
                 in_set(values2, 'volume_guid')
             ], any)
             included_values = set()
             for val in PredicatesTest.all_values:
                 if test_predicate.do_include({'volume_guid': val}):
                     included_values.add(val)
             self.assertEqual(included_values, values1.union(values2))