Mercurial > repos > chrisb > gap_all_glycan_tools
diff get_data/kegg_glycan/test_linkKEGG.py @ 1:0a5e0df17054 draft default tip
Uploaded
author | chrisb |
---|---|
date | Fri, 06 May 2016 08:05:48 -0400 |
parents | 89592faa2875 |
children |
line wrap: on
line diff
--- a/get_data/kegg_glycan/test_linkKEGG.py Wed Mar 23 14:35:56 2016 -0400 +++ b/get_data/kegg_glycan/test_linkKEGG.py Fri May 06 08:05:48 2016 -0400 @@ -40,3 +40,76 @@ m = lk.linked_entries_from_kegg("br", "gl:G10496") self.assertEquals(m,"") + def test_enzyme_glycan_search_1(self): + """ + test "2.4.99.1 ec: " returns + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1 ec:") + self.assertIn("2.4.99.1", m) + + + def test_enzyme_glycan_search_2(self): + """ + test "2.4.99.1 ec: 2.4.99.6" returns + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1 ec: 2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_3(self): + """ + test "2.4.99.1 ec:2.4.99.6" returns + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1 ec:2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_4(self): + """ + test "2.4.99.1+2.4.99.6" returns. This time '+' is or. + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1+2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_4b(self): + """ + test "2.4.99.1+ 2.4.99.6" returns. This time '+' is or. + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1+ 2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_5(self): + """ + test "2.4.99.1 2.4.99.6" returns. Space also means or for the link db. + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1 2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + + def test_enzyme_glycan_search_6(self): + """ + test "2.4.99.1+nana+2.4.99.6" returns. strangely when inserting junk it still works. + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1+nana+2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_6b(self): + """ + test "2.4.99.1 nana 2.4.99.6" returns. strangely when inserting junk it still works. + """ + m = lk.linked_entries_from_kegg("glycan", "2.4.99.1+nana+2.4.99.6" ) + self.assertIn("2.4.99.1", m) + self.assertIn("2.4.99.6", m) + + def test_enzyme_glycan_search_7(self): + """ + test "\"2.4.99.1\"" is a bad request as it includes quotes. + """ + from urllib2 import HTTPError + with self.assertRaises(HTTPError): + m = lk.linked_entries_from_kegg("glycan", "\"2.4.99.1\"" ) +