Exemple #1
0
    def setUp(self):
        # We are using the files of the Drosophila Gateway Vector Collection
        # (<https://emb.carnegiescience.edu/drosophila-gateway-vector-collection>)
        # as sample Gck files. We cannot redistribute those files along with
        # Biopython, so we need to download them now for the tests to run.
        if not os.path.exists("Gck/DGVC_GCK.zip"):
            try:
                requires_internet.check()
            except MissingExternalDependencyError:
                self.skipTest("Sample files missing and no Internet access")
                return

            try:
                with urlopen(
                        "https://emb.carnegiescience.edu/sites/default/files/DGVC_GCK.zip"
                ) as src, open("Gck/DGVC_GCK.zip", "wb") as dst:
                    shutil.copyfileobj(src, dst)
            except HTTPError:
                self.skipTest("Cannot download the sample files")
                return

        self.zipdata = ZipFile("Gck/DGVC_GCK.zip")
scope of this file as they are already covered in test_Entrez.py.

"""
from Bio import Entrez
from Bio import Medline
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord

import doctest
import os
import locale
import sys
import unittest

import requires_internet
requires_internet.check()

# This lets us set the email address to be sent to NCBI Entrez:
Entrez.email = "*****@*****.**"
Entrez.api_key = "5cfd4026f9df285d6cfc723c662d74bcbe09"

URL_HEAD = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/"
URL_TOOL = "tool=biopython"
URL_EMAIL = "email=biopython%40biopython.org"
URL_API_KEY = "api_key=5cfd4026f9df285d6cfc723c662d74bcbe09"


class EntrezOnlineCase(unittest.TestCase):
    def test_no_api_key(self):
        """Test Entrez.read without API key."""
        cached = Entrez.api_key
Exemple #3
0
#!/usr/bin/env python
"""Tests HotRand.
"""
# standard library
from __future__ import print_function

import unittest
import warnings

from Bio import BiopythonDeprecationWarning
warnings.simplefilter('ignore', BiopythonDeprecationWarning)

# local stuff
import requires_internet
requires_internet.check()

from Bio.HotRand import HotRandom


# --- helper classes and functions

def are_items_in_range( a, high, low ):
    for j in range( 0, len( a ) ):
        if( a[ j ] > high ):
            print('a[ %d ] is %d' % ( j , a[ j ] ))
            return 0
        if( a[ j ] < low ):
            print('a[ %d ] is %d' % ( j , a[ j ] ))
            return 0
    return 1