Ticket #10905: trac_10905-doctests.patch

File trac_10905-doctests.patch, 2.4 KB (added by ncohen, 10 years ago)
  • sage/graphs/base/c_graph.pyx

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1300023383 -28800
    # Node ID 1b52b9e7ee13a28f36cb2282d28b85b165f6a1e2
    # Parent  17a58011e11c6bb2fe64f3e03bbf0626ff684140
    trac 10905 -- shortest path all pairs through BFS computations. (fixing doctests)
    
    diff -r 17a58011e11c -r 1b52b9e7ee13 sage/graphs/base/c_graph.pyx
    a b  
    30863086        sage: dist, path = all_pairs_shortest_path_BFS(g)
    30873087        sage: all( dist[u][v] == g.distance(u,v) for u in g for v in g )
    30883088        True
     3089
     3090    TESTS:
     3091
     3092    Too large graphs::
     3093
     3094        sage: all_pairs_shortest_path_BFS(Graph(65536))
     3095        Traceback (most recent call last):
     3096        ...
     3097        ValueError: The graph backend contains more than 65535 nodes
     3098
    30893099    """
    30903100    from sage.rings.infinity import Infinity
    30913101
     
    30953105    cdef int n = max(vertices)+1
    30963106
    30973107    if n > <unsigned short> -1:
    3098         raise ValueError("The graph backend contains more than "+(<unsigned short> -1)+" nodes")
     3108        raise ValueError("The graph backend contains more than "+str(<unsigned short> -1)+" nodes")
    30993109
    31003110    # The vertices which have already been visited
    31013111    cdef bitset_t seen
  • sage/graphs/generic_graph.py

    diff -r 17a58011e11c -r 1b52b9e7ee13 sage/graphs/generic_graph.py
    a b  
    1106311063            ...     p.insert(0,path[u][p[0]])
    1106411064            sage: len(p) == dist[u][v] + 2
    1106511065            True
     11066
     11067        TESTS:
     11068
     11069        Wrong name for ``algorithm``::
     11070
     11071            sage: g.shortest_path_all_pairs(algorithm="Bob")
     11072            Traceback (most recent call last):
     11073            ...
     11074            ValueError: The algorithm keyword can only be set to "auto", "BFS", "Floyd-Warshall-Python" or "Floyd-Warshall-Cython"
    1106611075        """
    1106711076        if default_weight != 1:
    1106811077            by_weight = True
     
    1108511094            raise ValueError("The algorithm keyword can only be set to "+
    1108611095                             "\"auto\","+
    1108711096                             " \"BFS\", "+
    11088                              "\"Floyd-Warshall-Cython\" or "+
     11097                             "\"Floyd-Warshall-Python\" or "+
    1108911098                             "\"Floyd-Warshall-Cython\"")
    1109011099
    1109111100        from sage.rings.infinity import Infinity