示例#1
0
 def test_check_similarity_of_sets(self):
     pairs = [{0, 1}, {2, 3}, {4, 8}, {1, 8}, {3, 4}, {0, 8}]
     pair_one = [{0, 8}, {1, 8}]
     pair_two = [{2, 3}, {3, 4}]
     self.assertTrue(check_similarity_of_sets(pair_one, pairs),
                     'set simililarity does not work correctly')
     self.assertFalse(check_similarity_of_sets(pair_two, pairs),
                      'set simililarity does not work correctly')
示例#2
0
def test_check_similarity_of_sets():
    pairs = [{0, 1}, {2, 3}, {4, 8}, {1, 8}, {3, 4}, {0, 8}]
    pair_one = [{0, 8}, {1, 8}]
    pair_two = [{2, 3}, {3, 4}]
    assert check_similarity_of_sets(
        pair_one, pairs), 'set simililarity does not work correctly'
    assert not check_similarity_of_sets(
        pair_two, pairs), 'set simililarity does not work correctly'
示例#3
0
 def produce_similarity_sets(list_of_lists):
     list_of_sets = list_of_lists_to_list_of_sets(list_of_lists)
     for pair_of_sets in make_pairs_of_sets(list_of_sets):
         if check_similarity_of_sets(pair_of_sets, list_of_sets):
             new = collapse_pair_of_sets(pair_of_sets)
             list_of_sets.append(new)
     return list_of_sets