# Copyright 2007-2010 by Peter Cock. All rights reserved. # Revisions copyright 2007-2008 by Michiel de Hoon. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Testing online code for fetching sequences, and parsing them Uses Bio.SeqIO to parse files downloaded with Bio.GenBank, Bio.WWW.NCBI, Bio.ExPASy etc. Goals: Make sure that all retrieval is working as expected. May catch some format changes early too. """ import sys import unittest import requires_internet requires_internet.check() from Bio import MissingExternalDependencyError #We want to test these: from Bio import Entrez from Bio import ExPASy #In order to check any sequences returned from Bio import SeqIO from StringIO import StringIO from Bio.SeqUtils.CheckSum import seguid from Bio.File import UndoHandle from Bio._py3k import _as_string #This lets us set the email address to be sent to NCBI Entrez: Entrez.email = "biopython-dev@biopython.org" class ExPASyTests(unittest.TestCase): """Tests for Bio.ExPASy module.""" def test_get_sprot_raw(self): """Bio.ExPASy.get_sprot_raw("O23729")""" identifier = "O23729" try: #This is to catch an error page from our proxy: handle = UndoHandle(ExPASy.get_sprot_raw(identifier)) if _as_string(handle.peekline()).startswith("