• Rajat Jain's avatar
    Reworked PriorityQueue and Added Tests (#1025) · fb57e952
    Rajat Jain a écrit
    * Reworked PriorityQueue spec
    
    Modified:
    - Priority Queue methods:
        queue[elem] now returns the first value of elem stored in queue
        elem in queue now correctly returns whether a copy of element is present regardless of the function value. Apparently the bug was introduced while trying to meet heapq spec
        del queue[elem] deletes the first instance of elem in queue correctly
    - Algorithms
        Same change in best_first_graph_search in romania_problem.py and search.py to make them compatible with the new spec
    - Tests
        Introduced 3 tests in test_utils.py to comprehensively test PriorityQueue's new spec
    
    * Reworked PriorityQueue spec
    
    Modified:
    - Priority Queue methods:
        queue[elem] now returns the first value of elem stored in queue
        elem in queue now correctly returns whether a copy of element is present regardless of the function value. Apparently the bug was introduced while trying to meet heapq spec
        del queue[elem] deletes the first instance of elem in queue correctly
    - Algorithms
        Same change in best_first_graph_search in romania_problem.py and search.py to make them compatible with the new spec
    - Tests
        Introduced 3 tests in test_utils.py to comprehensively test PriorityQueue's new spec
    fb57e952