def test_resolve_candidates_double_delete(self):
        """In the unfortunate case where *two* candidates are wrong make
        sure we don't blow up"""
        amend_map = {}

        n1 = Node("n1", label=["200", "1", "i"])
        n2 = Node("n2", label=["200", "1", "i"])
        amend_map["200-1-a-i"] = [{"node": n1, "candidate": True}, {"node": n2, "candidate": True}]
        amend_map["200-1-i"] = []
        changes.resolve_candidates(amend_map, warn=False)
        self.assertEqual(1, len(amend_map.keys()))
    def test_resolve_candidates_double_delete(self):
        """In the unfortunate case where *two* candidates are wrong make
        sure we don't blow up"""
        amend_map = {}

        n1 = Node('n1', label=['200', '1', 'i'])
        n2 = Node('n2', label=['200', '1', 'i'])
        amend_map['200-1-a-i'] = [{'node': n1, 'candidate': True},
                                  {'node': n2, 'candidate': True}]
        amend_map['200-1-i'] = []
        changes.resolve_candidates(amend_map, warn=False)
        self.assertEqual(1, len(amend_map.keys()))
def test_resolve_candidates_double_delete():
    """In the unfortunate case where *two* candidates are wrong make sure we
    don't blow up"""
    amend_map = {}

    n1 = Node('n1', label=['200', '1', 'i'])
    n2 = Node('n2', label=['200', '1', 'i'])
    amend_map['200-1-a-i'] = [{'node': n1, 'candidate': True},
                              {'node': n2, 'candidate': True}]
    amend_map['200-1-i'] = []
    changes.resolve_candidates(amend_map, warn=False)
    assert len(amend_map.keys()) == 1
    def test_resolve_candidates_accounted_for(self):
        amend_map = {}

        n1 = Node('n1', label=['200', '1'])
        amend_map['200-1-a'] = [{'node': n1, 'candidate': False}]

        n2 = Node('n2', label=['200', '2', 'i'])

        amend_map['200-2-a-i'] = [{'node': n2, 'candidate': True}]
        amend_map['200-2-i'] = [{'node': n2, 'candidate': False}]

        changes.resolve_candidates(amend_map, warn=False)
        self.assertEqual(2, len(amend_map.keys()))
    def test_resolve_candidates_accounted_for(self):
        amend_map = {}

        n1 = Node("n1", label=["200", "1"])
        amend_map["200-1-a"] = [{"node": n1, "candidate": False}]

        n2 = Node("n2", label=["200", "2", "i"])

        amend_map["200-2-a-i"] = [{"node": n2, "candidate": True}]
        amend_map["200-2-i"] = [{"node": n2, "candidate": False}]

        changes.resolve_candidates(amend_map, warn=False)
        self.assertEqual(2, len(amend_map.keys()))
    def test_resolve_candidates_accounted_for(self):
        amend_map = {}

        n1 = Node('n1', label=['200', '1'])
        amend_map['200-1-a'] = [{'node': n1, 'candidate': False}]

        n2 = Node('n2', label=['200', '2', 'i'])

        amend_map['200-2-a-i'] = [{'node': n2, 'candidate': True}]
        amend_map['200-2-i'] = [{'node': n2, 'candidate': False}]

        changes.resolve_candidates(amend_map, warn=False)
        self.assertEqual(2, len(amend_map.keys()))
    def test_resolve_candidates(self):
        amend_map = {}

        n1 = Node("n1", label=["200", "1"])
        amend_map["200-1-a"] = [{"node": n1, "candidate": False}]

        n2 = Node("n2", label=["200", "2", "i"])
        amend_map["200-2-a-i"] = [{"node": n2, "candidate": True}]

        self.assertNotEqual(amend_map["200-2-a-i"][0]["node"].label_id(), "200-2-a-i")

        changes.resolve_candidates(amend_map)

        self.assertEqual(amend_map["200-2-a-i"][0]["node"].label_id(), "200-2-a-i")
def test_resolve_candidates():
    amend_map = {}

    n1 = Node('n1', label=['200', '1'])
    amend_map['200-1-a'] = [{'node': n1, 'candidate': False}]

    n2 = Node('n2', label=['200', '2', 'i'])
    amend_map['200-2-a-i'] = [{'node': n2, 'candidate': True}]

    assert amend_map['200-2-a-i'][0]['node'].label_id() != '200-2-a-i'

    changes.resolve_candidates(amend_map)

    assert amend_map['200-2-a-i'][0]['node'].label_id() == '200-2-a-i'
    def test_resolve_candidates(self):
        amend_map = {}

        n1 = Node('n1', label=['200', '1'])
        amend_map['200-1-a'] = [{'node': n1, 'candidate': False}]

        n2 = Node('n2', label=['200', '2', 'i'])
        amend_map['200-2-a-i'] = [{'node': n2, 'candidate': True}]

        self.assertNotEqual(amend_map['200-2-a-i'][0]['node'].label_id(),
                            '200-2-a-i')

        changes.resolve_candidates(amend_map)

        self.assertEqual(amend_map['200-2-a-i'][0]['node'].label_id(),
                         '200-2-a-i')
    def test_resolve_candidates(self):
        amend_map = {}

        n1 = Node('n1', label=['200', '1'])
        amend_map['200-1-a'] = [{'node': n1, 'candidate': False}]

        n2 = Node('n2', label=['200', '2', 'i'])
        amend_map['200-2-a-i'] = [{'node': n2, 'candidate': True}]

        self.assertNotEqual(
            amend_map['200-2-a-i'][0]['node'].label_id(),
            '200-2-a-i')

        changes.resolve_candidates(amend_map)

        self.assertEqual(
            amend_map['200-2-a-i'][0]['node'].label_id(),
            '200-2-a-i')