@@ -57,6 +57,22 @@ def test_fetch_uniprot_to_protein(self):
5757 assert len (protein .references ) == 1
5858 assert protein .references [0 ] == "https://www.uniprot.org/uniprotkb/P07327"
5959
60+ def test_fetch_uniprot_to_protein_with_prefix (self ):
61+ protein = fetch_uniprot ("uniprot:P07327" )
62+ assert protein is not None
63+
64+ assert protein .id == "alcohol_dehydrogenase_1a"
65+ assert protein .name == "Alcohol dehydrogenase 1A"
66+ assert protein .constant is True
67+ assert protein .ecnumber == "1.1.1.1"
68+ assert protein .organism == "Homo sapiens"
69+ assert protein .organism_tax_id == "9606"
70+
71+ assert protein .ld_id == "uniprot:P07327"
72+ assert "uniprot:P07327" in protein .ld_type
73+ assert len (protein .references ) == 1
74+ assert protein .references [0 ] == "https://www.uniprot.org/uniprotkb/P07327"
75+
6076 def test_fetch_uniprot_to_protein_with_id (self ):
6177 protein = fetch_uniprot ("P07327" , protein_id = "p1" )
6278 assert protein is not None
@@ -103,7 +119,19 @@ def test_fetch_rhea_to_reaction_invalid_id(self):
103119 fetch_rhea ("INVALID_ID" )
104120
105121 def test_fetch_pubchem_to_small_molecule (self ):
106- small_molecule = fetch_pubchem (cid = 2244 )
122+ small_molecule = fetch_pubchem (cid = "2244" )
123+ assert small_molecule is not None
124+ assert small_molecule .id == "2_acetyloxybenzoic_acid"
125+ assert small_molecule .name == "2-acetyloxybenzoic acid"
126+ assert small_molecule .canonical_smiles == "CC(=O)OC1=CC=CC=C1C(=O)O"
127+ assert small_molecule .inchikey == "BSYNRYMUTXBXSQ-UHFFFAOYSA-N"
128+ assert (
129+ small_molecule .inchi
130+ == "InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)"
131+ )
132+
133+ def test_fetch_pubchem_to_small_molecule_with_prefix (self ):
134+ small_molecule = fetch_pubchem (cid = "pubchem:2244" )
107135 assert small_molecule is not None
108136 assert small_molecule .id == "2_acetyloxybenzoic_acid"
109137 assert small_molecule .name == "2-acetyloxybenzoic acid"
@@ -116,7 +144,7 @@ def test_fetch_pubchem_to_small_molecule(self):
116144
117145 def test_fetch_pubchem_to_small_molecule_invalid_id (self ):
118146 with pytest .raises (ValueError ):
119- fetch_pubchem (cid = 162176127617627 )
147+ fetch_pubchem (cid = " 162176127617627" )
120148
121149 def test_fetch_pdb_to_protein (self ):
122150 protein = fetch_pdb ("1a23" )
@@ -131,6 +159,19 @@ def test_fetch_pdb_to_protein(self):
131159 == "AQYEDGKQYTTLEKPVAGAPQVLEFFSFFCPHCYQFEEVLHISDNVKKKLPEGVKMTKYHVNFMGGDLGKDLTQAWAVAMALGVEDKVTVPLFEGVQKTQTIRSASDIRDVFINAGIKGEEYDAAWNSFVVKSLVAQQEKAAADVQLRGVPAMFVNGKYQLNPQGMDTSNMDVFVQQYADTVKYLSEKK"
132160 )
133161
162+ def test_fetch_pdb_to_protein_with_prefix (self ):
163+ protein = fetch_pdb ("pdb:1a23" )
164+ assert protein is not None
165+ assert protein .id == "1a23_1"
166+ assert (
167+ protein .name
168+ == "SOLUTION NMR STRUCTURE OF REDUCED DSBA FROM ESCHERICHIA COLI, MINIMIZED AVERAGE STRUCTURE"
169+ )
170+ assert (
171+ protein .sequence
172+ == "AQYEDGKQYTTLEKPVAGAPQVLEFFSFFCPHCYQFEEVLHISDNVKKKLPEGVKMTKYHVNFMGGDLGKDLTQAWAVAMALGVEDKVTVPLFEGVQKTQTIRSASDIRDVFINAGIKGEEYDAAWNSFVVKSLVAQQEKAAADVQLRGVPAMFVNGKYQLNPQGMDTSNMDVFVQQYADTVKYLSEKK"
173+ )
174+
134175 def test_fetch_pdb_to_protein_invalid_id (self ):
135176 with pytest .raises (ValueError ):
136177 fetch_pdb ("INVALID_ID" )
0 commit comments