#NEWLINE# def test_subgraph( self ) : #NEWLINE# #INDENT# s1 = Graph ( ) #NEWLINE# s1 . node ( 'A' ) #NEWLINE# s1 . node ( 'B' ) #NEWLINE# s1 . node ( 'C' ) #NEWLINE# s1 . edge ( 'A' , 'B' , constraint = 'false' ) #NEWLINE# s1 . edges ( [ 'AC' , 'BC' ] ) #NEWLINE# s2 = Graph ( ) #NEWLINE# s2 . node ( 'D' ) #NEWLINE# s2 . node ( 'E' ) #NEWLINE# s2 . node ( 'F' ) #NEWLINE# s2 . edge ( 'D' , 'E' , constraint = 'false' ) #NEWLINE# s2 . edges ( [ 'DF' , 'EF' ] ) #NEWLINE# dot = Graph ( ) #NEWLINE# dot . subgraph ( s1 ) #NEWLINE# dot . subgraph ( s2 ) #NEWLINE# dot . attr ( 'edge' , style = 'dashed' ) #NEWLINE# dot . edges ( [ 'AD' , 'BE' , 'CF' ] ) #NEWLINE# self . assertEqual ( dot . source , 'graph {\n\tsubgraph {\n\t\tA\n\t\tB\n\t\tC\n\t\t\tA -- B [constraint=false]\n\t\t\tA -- C\n\t\t\tB -- C\n\t}\n\tsubgraph {\n\t\tD\n\t\tE\n\t\tF\n\t\t\tD -- E [constraint=false]\n\t\t\tD -- F\n\t\t\tE -- F\n\t}\n\tedge [style=dashed]\n\t\tA -- D\n\t\tB -- E\n\t\tC -- F\n}' )