def test_build_nx_graph_no_choices_predefined(self): q_graph = create_diamond_plus() service = QuestionGraphService(q_graph) edges = service._get_edges(q_graph) nx_graph = service._build_nx_graph(q_graph, edges) self.assertIsInstance(nx_graph, MultiDiGraph) self.assertEqual(len(nx_graph.nodes), 7)
def test_get_reachable_questions(self): q_graph = create_diamond_plus() service = QuestionGraphService(q_graph) edges = service._get_edges(q_graph) nx_graph = service._build_nx_graph(q_graph, edges) questions = service._get_reachable_questions(nx_graph, q_graph) self.assertEqual(len(questions), 5) self.assertEqual({q.analysis_key for q in questions.values()}, set(f'q{n}' for n in range(1, 6)))
def test_get_edges(self): q_graph = create_diamond_plus() service = QuestionGraphService(q_graph) edges = service._get_edges(q_graph) self.assertEqual(len(edges), 6)