Example #1
0
          testanswer = ANSWER6_testanswer,
          expected_val = "False",
          name = ANSWER6_getargs
          )

############ OPTIONAL WARM-UP: BFS and DFS ############

do_bfs = True
try:
    bfs(NEWGRAPH1, 'S', 'H')
except NotImplementedError:
    do_bfs = False

do_dfs = True
try:
    dfs(NEWGRAPH1, 'S', 'H')
except NotImplementedError:
    do_dfs = False

if do_bfs:

    ### TEST 7-optional ###

    def bfs_1_getargs():
        # (graph, start, goal, extended=None, queue=None)
        return [ NEWGRAPH1, 'S', 'H' ]

    def bfs_1_testanswer(val, original_val = None):
        if val and len(val) > 0 and isinstance(val[0], dict):
            raise Exception("Error: Graph functions are supposed to return a list of node *names*, not node dictionaries!")
          testanswer = ANSWER6_testanswer,
          expected_val = "False",
          name = ANSWER6_getargs
          )

############ OPTIONAL WARM-UP: BFS and DFS ############

do_bfs = True
try:
    bfs(NEWGRAPH1, 'S', 'H')
except NotImplementedError:
    do_bfs = False

do_dfs = True
try:
    dfs(NEWGRAPH1, 'S', 'H')
except NotImplementedError:
    do_dfs = False

if do_bfs:

    ### TEST 7-optional ###

    def bfs_1_getargs():
        # (graph, start, goal, extended=None, queue=None)
        return [ NEWGRAPH1, 'S', 'H' ]

    def bfs_1_testanswer(val, original_val = None):
        if val and len(val) > 0 and isinstance(val[0], dict):
            raise Exception, "Error: Graph functions are supposed to return a list of node *names*, not node dictionaries!"