def test_empty_graph():
    graph = Graph()
    cities = []
    actual_connected, actual_weight = get_edge(graph, cities)
    expected_connected, expected_weight = False, 0
    assert actual_connected == expected_connected
    assert actual_weight == expected_weight
Example #2
0
def test_cities_empty(graph):
    """
    Trip with no cities means no trip.
    """

    expected = 'False:$0'
    actual = get_edge(graph, [])
    assert actual == expected
Example #3
0
def test_get_edge(graph):
    """
    Trip through graph can happen.
    """

    cities = ['a', 'b', 'c']

    expected = 'True:$249'
    actual = get_edge(graph, cities)
    assert actual == expected
Example #4
0
def test_graph_empty():
    """
    Trip through empty can't happen.
    """

    graph = Graph()
    cities = ['a', 'b', 'c']

    expected = 'False:$0'
    actual = get_edge(graph, cities)
    assert actual == expected
def test_two_connection_false(flights):
    graph = flights["graph"]
    route = [flights["narnia"], flights["arendelle"], flights["naboo"]]
    actual = get_edge(graph, route)
    expected = (False, 0)
    assert actual == expected
def test_one_connection_false(flights):
    graph = flights["graph"]
    route = [flights["naboo"], flights["pandora"]]
    actual = get_edge(graph, route)
    expected = (False, 0)
def test_two_connection_true(flights):
    graph = flights["graph"]
    route = [flights["arendelle"], flights["monstropolis"], flights["naboo"]]
    actual = get_edge(graph, route)
    expected = (True, 115)
    assert actual == expected
def test_one_connection_true(flights):
    graph = flights["graph"]
    route = [flights["metroville"], flights["pandora"]]
    actual = get_edge(graph, route)
    expected = (True, 82)
    assert actual == expected