Ejemplo n.º 1
0
def test_complex_removal():
    """Test more complex clustering with removing a cluster."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(['A', 'B']), 2: set(['C'])}
    partition_after = {3: set(['A', 'B', 'C'])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 3)], [], [2])
Ejemplo n.º 2
0
def test_complex_matching():
    """Test more complex clustering with no removal or adding."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, 4), (2, 3)], [], [])
Ejemplo n.º 3
0
def test_complex_adding():
    """Test more complex clustering with adding a new cluster."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(['A', 'B', 'C'])}
    partition_after = {2: set(['A', 'B']), 3: set(['C'])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 2)], [3], [])
Ejemplo n.º 4
0
def test_the_same_clusters():
    """Test if the two exact clusters will be matched."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(['A', 'B'])}
    partition_after = {2: set(['A', 'B'])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 2)], [], [])
Ejemplo n.º 5
0
def test_cluster_adding():
    """Test if the new cluster will be distinguished."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {}
    partition_after = {1: set(['A', 'B'])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([], [1], [])
Ejemplo n.º 6
0
def test_different_types_as_keys():
    """Test clustering based on strings as keys."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, '3')], [4], ['2'])
Ejemplo n.º 7
0
def test_complex_adding():
    """Test more complex clustering with adding a new cluster."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(["A", "B", "C"])}
    partition_after = {2: set(["A", "B"]), 3: set(["C"])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 2)], [3], [])
Ejemplo n.º 8
0
def test_complex_removal():
    """Test more complex clustering with removing a cluster."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(["A", "B"]), 2: set(["C"])}
    partition_after = {3: set(["A", "B", "C"])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 3)], [], [2])
Ejemplo n.º 9
0
def test_complex_matching():
    """Test more complex clustering with no removal or adding."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, 4), (2, 3)], [], [])
Ejemplo n.º 10
0
def test_cluster_removal():
    """Test if the removed cluster will be distinguished."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(["A", "B"])}
    partition_after = {}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([], [], [1])
Ejemplo n.º 11
0
def test_the_same_clusters():
    """Test if the two exact clusters will be matched."""
    from beard_server.modules.matching.simplex import _solve_clusters

    partition_before = {1: set(["A", "B"])}
    partition_after = {2: set(["A", "B"])}

    match = _solve_clusters(partition_before, partition_after)

    assert match == ([(1, 2)], [], [])
Ejemplo n.º 12
0
def test_many_virtual_agents():
    """Test clustering based on strings as keys."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, 1)], ["3", 2], [])
Ejemplo n.º 13
0
def test_different_types_as_keys():
    """Test clustering based on strings as keys."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, "3")], [4], ["2"])
Ejemplo n.º 14
0
def test_many_virtual_agents():
    """Test clustering based on strings as keys."""
    from beard_server.modules.matching.simplex import _solve_clusters

    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)

    assert match == ([(1, 1)], ['3', 2], [])