Back to index

python-biopython  1.60
Public Member Functions
test_TogoWS.TogoSearch Class Reference

List of all members.

Public Member Functions

def test_bad_args_just_limit
def test_bad_args_just_offset
def test_bad_args_zero_limit
def test_bad_args_zero_offset
def test_bad_args_non_int_offset
def test_bad_args_non_int_limit
def test_pubmed_search_togows
def test_pubmed_search_bioruby
def test_pubmed_search_porin
def test_pdb_search_porin
def test_embl_search_porin
def test_uniprot_search_lung_cancer
def check

Detailed Description

Search tests.

Definition at line 373 of file test_TogoWS.py.


Member Function Documentation

def test_TogoWS.TogoSearch.check (   self,
  database,
  search_term,
  expected_matches = [],
  limit = None 
)

Definition at line 447 of file test_TogoWS.py.

00447 
00448     def check(self, database, search_term, expected_matches=[], limit=None):
00449         if expected_matches and limit:
00450             raise ValueError("Bad test - TogoWS makes no promises about order")
00451         search_count = TogoWS.search_count(database, search_term)
00452         if expected_matches and search_count < len(expected_matches):
00453             raise ValueError("Only %i matches, expected at least %i" \
00454                              % (search_count, len(expected_matches)))
00455         if search_count > 5000 and not limit:
00456             print "%i results, skipping" % search_count
00457             return
00458         if limit:
00459             count = min(search_count, limit)
00460         else:
00461             count = search_count
00462 
00463         #Iteration should find everything... unless a limit is used
00464         search_iter = list(TogoWS.search_iter(database, search_term, limit))
00465         self.assertEqual(count, len(search_iter))
00466         for match in expected_matches:
00467             self.assert_(match in search_iter,
00468                          "Expected %s in results but not" % match)
00469 

Here is the caller graph for this function:

Reject Bio.TogoWS.search(...) with just limit

Definition at line 376 of file test_TogoWS.py.

00376 
00377     def test_bad_args_just_limit(self):
00378         """Reject Bio.TogoWS.search(...) with just limit"""
00379         self.assertRaises(ValueError, TogoWS.search,
00380                           "pubmed", "lung+cancer", limit=10)

Reject Bio.TogoWS.search(...) with just offset

Definition at line 381 of file test_TogoWS.py.

00381 
00382     def test_bad_args_just_offset(self):
00383         """Reject Bio.TogoWS.search(...) with just offset"""
00384         self.assertRaises(ValueError, TogoWS.search,
00385                           "pubmed", "lung+cancer", offset=10)

Reject Bio.TogoWS.search(...) with non-integer limit

Definition at line 401 of file test_TogoWS.py.

00401 
00402     def test_bad_args_non_int_limit(self):
00403         """Reject Bio.TogoWS.search(...) with non-integer limit"""
00404         self.assertRaises(ValueError, TogoWS.search,
00405                           "pubmed", "lung+cancer", offset=1, limit="lots")

Reject Bio.TogoWS.search(...) with non-integer offset

Definition at line 396 of file test_TogoWS.py.

00396 
00397     def test_bad_args_non_int_offset(self):
00398         """Reject Bio.TogoWS.search(...) with non-integer offset"""
00399         self.assertRaises(ValueError, TogoWS.search,
00400                           "pubmed", "lung+cancer", offset="test", limit=10)

Reject Bio.TogoWS.search(...) with zero limit

Definition at line 386 of file test_TogoWS.py.

00386 
00387     def test_bad_args_zero_limit(self):
00388         """Reject Bio.TogoWS.search(...) with zero limit"""
00389         self.assertRaises(ValueError, TogoWS.search,
00390                           "pubmed", "lung+cancer", offset=1, limit=0)

Reject Bio.TogoWS.search(...) with zero offset

Definition at line 391 of file test_TogoWS.py.

00391 
00392     def test_bad_args_zero_offset(self):
00393         """Reject Bio.TogoWS.search(...) with zero offset"""
00394         self.assertRaises(ValueError, TogoWS.search,
00395                           "pubmed", "lung+cancer", offset=0, limit=10)

Bio.TogoWS.search_iter("embl", "human pore", limit=200) etc

Count was about 255 at time of writing.

Definition at line 430 of file test_TogoWS.py.

00430 
00431     def test_embl_search_porin(self):
00432         """Bio.TogoWS.search_iter("embl", "human pore", limit=200) etc
00433 
00434         Count was about 255 at time of writing.
00435         """
00436         self.check("embl", "human pore", limit=200)

Here is the call graph for this function:

Bio.TogoWS.search_iter("pdb", "porin") etc

Count was about 130 at time of writing.

Definition at line 423 of file test_TogoWS.py.

00423 
00424     def test_pdb_search_porin(self):
00425         """Bio.TogoWS.search_iter("pdb", "porin") etc
00426 
00427         Count was about 130 at time of writing.
00428         """
00429         self.check("pdb", "porin", ["2j1n", "2vqg", "3m8b", "2k0l"])

Here is the call graph for this function:

Bio.TogoWS.search_iter("pubmed", "BioRuby") etc

Definition at line 410 of file test_TogoWS.py.

00410 
00411     def test_pubmed_search_bioruby(self):
00412         """Bio.TogoWS.search_iter("pubmed", "BioRuby") etc"""
00413         self.check("pubmed", "BioRuby", ["20739307", "20015970", "14693808"])

Here is the call graph for this function:

Bio.TogoWS.search_iter("pubmed", "human porin") etc

Count was 339 at time of writing, this was choosen to
be larger than the default chunk size for iteration,
but still not too big to download the full list.

Definition at line 414 of file test_TogoWS.py.

00414 
00415     def test_pubmed_search_porin(self):
00416         """Bio.TogoWS.search_iter("pubmed", "human porin") etc
00417 
00418         Count was 339 at time of writing, this was choosen to
00419         be larger than the default chunk size for iteration,
00420         but still not too big to download the full list.
00421         """
00422         self.check("pubmed", "human porin", ["21189321", "21835183"])

Here is the call graph for this function:

Bio.TogoWS.search_iter("pubmed", "TogoWS") etc

Definition at line 406 of file test_TogoWS.py.

00406 
00407     def test_pubmed_search_togows(self):
00408         """Bio.TogoWS.search_iter("pubmed", "TogoWS") etc"""
00409         self.check("pubmed", "TogoWS", ["20472643"])

Here is the call graph for this function:

Bio.TogoWS.search_iter("uniprot", "lung+cancer", limit=150) etc

Search count was 1327 at time of writing, a bit large to
download all the results in a unit test. Want to use a limit
larger than the batch size (100) to ensure at least two
batches.

Definition at line 437 of file test_TogoWS.py.

00437 
00438     def test_uniprot_search_lung_cancer(self):
00439         """Bio.TogoWS.search_iter("uniprot", "lung+cancer", limit=150) etc
00440 
00441         Search count was 1327 at time of writing, a bit large to
00442         download all the results in a unit test. Want to use a limit
00443         larger than the batch size (100) to ensure at least two
00444         batches.
00445         """
00446         self.check("uniprot", "lung+cancer", limit=150)

Here is the call graph for this function:


The documentation for this class was generated from the following file: