<s> import six <EOL> from nailgun . orchestrator import graph_visualization <EOL> from nailgun . orchestrator import orchestrator_graph <EOL> from nailgun . test import base <EOL> class TestGraphSolverViualization ( base . BaseUnitTest ) : <EOL> def get_dotgraph_with_tasks ( self , tasks ) : <EOL> graph = orchestrator_graph . GraphSolver ( ) <EOL> graph . add_tasks ( tasks ) <EOL> visualization = graph_visualization . GraphVisualization ( graph ) <EOL> dotgraph = visualization . get_dotgraph ( ) <EOL> return dotgraph . to_string ( ) <EOL> def test_stage_type ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' , '<STR_LIT:type>' : '<STR_LIT>' } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> def test_group_type ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' , '<STR_LIT:type>' : '<STR_LIT>' } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> six . assertRegex ( self , dotgraph , <EOL> '<STR_LIT>' ) <EOL> def test_skipped_type ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' , '<STR_LIT:type>' : '<STR_LIT>' } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> self . assertIn ( '<STR_LIT>' , dotgraph ) <EOL> def test_add_simple_connection ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' } , <EOL> { '<STR_LIT:id>' : '<STR_LIT>' , '<STR_LIT>' : [ '<STR_LIT>' ] } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> self . assertIn ( '<STR_LIT>' , dotgraph ) <EOL> def test_node_default_attrs ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> six . assertRegex ( self , dotgraph , '<STR_LIT>' ) <EOL> def test_skipped_metaparam ( self ) : <EOL> tasks = [ <EOL> { '<STR_LIT:id>' : '<STR_LIT>' , '<STR_LIT>' : True } , <EOL> ] <EOL> dotgraph = self . get_dotgraph_with_tasks ( tasks ) <EOL> self . assertIn ( '<STR_LIT>' , dotgraph ) </s>
