Ejemplo n.º 1
0
 def test_load_results(self):
     client = ot.get_client()
     results = ot.query(client, q='conditions.name:NAFLD')
     tmp_f = os.path.join(self.test_dir, 'test.pkl')
     ot.save_results(filename=tmp_f, results=results)
     results2 = ot.load_results(tmp_f)
     self.assertEqual(results['total_count'], results2['total_count'])
     self.assertEqual(len(results['items']), len(results2['items']))
Ejemplo n.º 2
0
    def test_query_trials(self):
        client = ot.get_client()

        results = ot.query(client, q='conditions.name:NAFLD')
        self.assertIsNotNone(results)
        self.assertTrue('items' in results)
        self.assertTrue('total_count' in results)
        self.assertTrue(results['items'] > 0)
Ejemplo n.º 3
0
 def test_create_graph_for_query(self):
     query = 'conditions.name:NAFLD'
     client = ot.get_client()
     qg.get_trials_for_query(client, query=query, directory=self.test_dir)
     qg.create_graph_for_query(query=query, directory=self.test_dir)
Ejemplo n.º 4
0
 def test_save_results(self):
     client = ot.get_client()
     results = ot.query(client, q='conditions.name:NAFLD')
     tmp_f = os.path.join(self.test_dir, 'test.pkl')
     ot.save_results(filename=tmp_f, results=results)
     self.assertTrue(os.path.exists(tmp_f))
Ejemplo n.º 5
0
 def test_client(self):
     """ Test the OpenTrials client.
     :return:
     """
     client = ot.get_client()
     self.assertIsNotNone(client, "Client must exist.")