def test_database_properties(self, mock_json_retriever): mock_json_retriever.return_value = [ { "accession": "CHEMBL1742477", "database": "ChEMBL Ligand", "url": "http://www.ebi.ac.uk/chembldb/index.php/compound/inspect/CHEMBL1742477", "species": "None" }, { "accession": "57347", "database": "PubChem CID", "url": "http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=57347", "species": "None" } ] ligand = Ligand(self.ligand_json) self.assertEqual(len(ligand.database_links()), 2) self.assertIsInstance(ligand.database_links()[0], DatabaseLink) self.assertIsInstance(ligand.database_links()[1], DatabaseLink) self.assertEqual(ligand.database_links()[0].accession(), "CHEMBL1742477") self.assertEqual(ligand.database_links()[1].accession(), "57347")
def test_database_properties(self, mock_json_retriever): mock_json_retriever.return_value = [{ "accession": "CHEMBL1742477", "database": "ChEMBL Ligand", "url": "http://www.ebi.ac.uk/chembldb/index.php/compound/inspect/CHEMBL1742477", "species": "None" }, { "accession": "57347", "database": "PubChem CID", "url": "http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid=57347", "species": "None" }] ligand = Ligand(self.ligand_json) self.assertEqual(len(ligand.database_links()), 2) self.assertIsInstance(ligand.database_links()[0], DatabaseLink) self.assertIsInstance(ligand.database_links()[1], DatabaseLink) self.assertEqual(ligand.database_links()[0].accession(), "CHEMBL1742477") self.assertEqual(ligand.database_links()[1].accession(), "57347")
def test_database_properties_when_no_json(self, mock_json_retriever): mock_json_retriever.return_value = None ligand = Ligand(self.ligand_json) self.assertEqual(ligand.database_links(), [])