def test_answer_immediate_query(): db = _get_test_db() qm = QueryManager(db=db, model_managers=[test_mm]) results = qm.answer_immediate_query('*****@*****.**', 1, query_object, ['test'], subscribe=False) assert len(results) == 1 assert results[0]['model'] == 'test' assert results[0]['query'] == simple_query assert isinstance(results[0]['response'], str) assert 'BRAF activates MAP2K1.' in results[0]['response'], \ results[0]['response'] assert isinstance(results[0]['date'], str)
def test_immediate_dynamic(): db = _get_test_db() qm = QueryManager(db=db, model_managers=[test_mm]) query_hashes = qm.answer_immediate_query( test_email, 1, dyn_query, ['test'], subscribe=False)[ 'dynamic_property'] assert query_hashes == [-27775603206605897], query_hashes results = qm.retrieve_results_from_hashes(query_hashes, 'dynamic_property') assert len(results) == 1, results assert query_hashes[0] in results result_values = results[query_hashes[0]] assert result_values['model'] == 'test' assert result_values['query'] == 'Active MAP2K1 is eventually high.' assert isinstance(result_values['date'], str) assert result_values['result'] == [ 'Pass', 'Satisfaction rate is 100% after 2 simulations.'] assert isinstance(result_values['image'], str)
def test_immediate_intervention(): db = _get_test_db() qm = QueryManager(db=db, model_managers=[test_mm]) query_hashes = qm.answer_immediate_query( test_email, 1, interv_query, ['test'], subscribe=False)['simple_intervention_property'] assert query_hashes == [14834228758745381], query_hashes results = qm.retrieve_results_from_hashes(query_hashes, 'simple_intervention_property') assert len(results) == 1, results assert query_hashes[0] in results result_values = results[query_hashes[0]] assert result_values['model'] == 'test' assert result_values['query'] == 'BRAF increases active MAP2K1.' assert isinstance(result_values['date'], str) assert result_values['result'] == [ 'Pass', 'Yes, the amount of target entity increased.' ] assert isinstance(result_values['image'], str)
def test_answer_immediate_query(): db = _get_test_db() qm = QueryManager(db=db, model_managers=[test_mm]) query_hashes = qm.answer_immediate_query( test_email, 1, query_object, ['test'], subscribe=False)[ 'path_property'] assert query_hashes == [35683418474694258], query_hashes results = qm.retrieve_results_from_hashes(query_hashes) assert len(results) == 1 assert query_hashes[0] in results result_values = results[query_hashes[0]] assert result_values['model'] == 'test' assert result_values['query'] == simple_query assert isinstance(result_values['date'], str) assert result_values['pysb'] == ['Pass', [test_response['3801854542']]], \ result_values['pysb'] assert result_values['pybel'] == ['Pass', [test_response['3801854542']]] assert result_values['signed_graph'][0] == 'Pass' assert result_values['unsigned_graph'][0] == 'Pass'
def test_immediate_open(): db = _get_test_db() qm = QueryManager(db=db, model_managers=[test_mm]) query_hashes = qm.answer_immediate_query( test_email, 1, open_query, ['test'], subscribe=False)[ 'open_search_query'] assert query_hashes == [-13552944417558866], query_hashes results = qm.retrieve_results_from_hashes(query_hashes) assert len(results) == 1 assert query_hashes[0] in results result_values = results[query_hashes[0]] assert result_values['model'] == 'test' assert result_values['query'] == 'What does BRAF activate?' assert isinstance(result_values['date'], str) for mc_type in ['pysb', 'pybel', 'signed_graph', 'unsigned_graph']: assert result_values[mc_type][0] == 'Pass' assert isinstance(result_values[mc_type][1], list) assert test_response['3801854542']['path'] in [ res['path'] for res in result_values[mc_type][1]]