def test_update_labels(self): matrix = [[7, 4, 3], [3, 1, 2], [3, 0, 0]] h = Hungarian(matrix) h._init_labels() h._update_labels({0, 1}, {0}) self.assertEqual(h.x_labels, [6, 2, 3]) self.assertEqual(h.y_labels, [1, 0, 0])
def test_neighbourhood_s_equals_t(self): matrix = [[7, 4, 3], [3, 1, 2], [3, 0, 0]] h = Hungarian(matrix) h._init_labels() h.matching = {0: 0} h.inverse_matching = {0: 0} h._update_labels = MagicMock() copy_find_augmenting_path = h._find_augmenting_path h._find_augmenting_path = MagicMock() copy_find_augmenting_path({1: None, 0: 1}, {1, 0}, {0}) h._update_labels.assert_called_once_with({1, 0}, {0})