﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	launchpad_bug
1881	test utility for comparing sets	davidsarah	davidsarah	"From [https://github.com/zooko/tahoe-lafs/commit/73d5a059bda6cf5a9c484a6af332d764069b0ba1], re: this code
{{{
    responding_set = frozenset([s.get_serverid() for s in prr.get_servers_responding()])
    self.failIf(expected - responding_set, expected - responding_set)
    self.failIf(responding_set - expected, responding_set - expected)
    self.failUnlessEqual(expected,
                         set([s.get_serverid()
                              for s in prr.get_servers_responding()]))
}}}

How about we add a mixin that allows us to write:
{{{
self.failUnlessEqualSets([s.get_serverid() for s in prr.get_servers_responding()],
                         self.g.get_all_serverids())
}}}
e.g.
{{{
class TestUtilMixin:  # might merge with ReallyEqualMixin, etc.
    def failUnlessEqualSets(self, actual, expected):
        actual_set = set(actual)
        expected_set = set(expected)
        self.failUnlessEqual(actual_set, expected_set,
                             (""\nexpected - actual = %r""
                              ""\nactual - expected = %r"")
                             % (expected_set - actual_set, actual_set - expected_set))
}}}

There are quite a few cases in the tests that could use this."	defect	assigned	minor	undecided	code	1.9.2		test cleanup		
