def test_strings_as_keys(self): """Test clustering based on strings as keys.""" partition_before = {"1": set(['A', 'B']), "2": set(['C'])} partition_after = {"3": set(['A', 'B', 'C'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([('1', '3')], [], ['2']))
def test_complex_adding(self): """Test more complex clustering with adding a new cluster.""" partition_before = {1: set(['A', 'B', 'C'])} partition_after = {2: set(['A', 'B']), 3: set(['C'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 2)], [3], []))
def test_complex_removal(self): """Test more complex clustering with removing a cluster.""" partition_before = {1: set(['A', 'B']), 2: set(['C'])} partition_after = {3: set(['A', 'B', 'C'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 3)], [], [2]))
def test_cluster_adding(self): """Test if the new cluster will be distinguished.""" partition_before = {} partition_after = {1: set(['A', 'B'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([], [1], []))
def test_complex_matching(self): """Test more complex clustering with no removal or adding.""" partition_before = {1: set(['A', 'B']), 2: set(['C', 'D', 'E'])} partition_after = {3: set(['A', 'C', 'E']), 4: set(['B', 'D'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 4), (2, 3)], [], []))
def test_the_same_clusters(self): """Test if the two exact clusters will be matched.""" partition_before = {1: set(['A', 'B'])} partition_after = {2: set(['A', 'B'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 2)], [], []))
def test_different_types_as_keys(self): """Test clustering based on strings as keys.""" partition_before = {1: set(['A', 'B']), "2": set(['C'])} partition_after = {"3": set(['A', 'B', 'C']), 4: set(['E', 'F'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, '3')], [4], ['2']))
def test_cluster_removal(self): """Test if the removed cluster will be distinguished.""" partition_before = {1: set(['A', 'B'])} partition_after = {} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([], [], [1]))
def test_many_virtual_agents(self): """Test clustering based on strings as keys.""" partition_before = {1: set(['A'])} partition_after = {1: set(['A', 'B', 'C']), 2: set(['D']), "3": set(['E', 'F'])} match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 1)], ['3', 2], []))
def test_many_virtual_agents(self): """Test clustering based on strings as keys.""" partition_before = {1: set(['A'])} partition_after = { 1: set(['A', 'B', 'C']), 2: set(['D']), "3": set(['E', 'F']) } match = _solve_clusters(partition_before, partition_after) self.assertEquals(match, ([(1, 1)], ['3', 2], []))