Beispiel #1
0
 def test_write_set(self):
     data_out = {1, 2, 3}
     data_path = os.path.join(self.dir.name, "1.tmp")
     utils.write_set(data_out, data_path)
     with open(data_path, "r") as fp:
         data_in = fp.read()
     self.assertEqual("\n".join((str(i) for i in sorted(data_out))) + "\n", data_in)
Beispiel #2
0
def command_make_difference(args):
    set1, set2 = utils.read_two_sets(args)
    utils.write_set(set1 - set2)
Beispiel #3
0
def command_make_union(args):
    result = set()
    for s in utils.read_many_sets(args):
        result |= s
    utils.write_set(result)
Beispiel #4
0
def command_make_intersection(args):
    result = set()
    for elem in utils.read_many_sets(args):
        result &= elem
    utils.write_set(result)