Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(8)  |  Derive(0)  |  Import(2)

src/c/o/cogent-1.5.3/tests/test_parse/test_ncbi_taxonomy.py   cogent(Download)
#!/usr/bin/env python
"""Tests of parsers for dealing with NCBI Taxonomy files.
"""
 
from cogent.parse.ncbi_taxonomy import MissingParentError, NcbiTaxon, \
    def setUp(self):
        self.tx = NcbiTaxonomyFromFiles(good_nodes, good_names)
 
    def test_init_good(self):
        """NcbiTaxonomyFromFiles should pass spot-checks of resulting objects"""
    def test_init_bad(self):
        """NcbiTaxonomyFromFiles should produce deadbeats by default"""
        bad_tx = NcbiTaxonomyFromFiles(bad_nodes, good_names)
        self.assertEqual(len(bad_tx.Deadbeats), 2)
        assert 777 in bad_tx.Deadbeats
    def test_init_strict(self):
        """NcbiTaxonomyFromFiles should fail if strict and deadbeats exist"""
        tx = NcbiTaxonomyFromFiles(good_nodes, good_names, strict=True)
        self.assertRaises(MissingParentError, NcbiTaxonomyFromFiles, \
            bad_nodes, good_names, strict=True)
'5555|z||scientific name|',
]
        tx = NcbiTaxonomyFromFiles(nested_species, nested_names)
        dec = tx[3].getRankedDescendants('superclass')
        self.assertEqual(len(dec), 1)

src/p/y/pycogent-HEAD/tests/test_parse/test_ncbi_taxonomy.py   pycogent(Download)
#!/usr/bin/env python
"""Tests of parsers for dealing with NCBI Taxonomy files.
"""
 
from cogent.parse.ncbi_taxonomy import MissingParentError, NcbiTaxon, \
    def setUp(self):
        self.tx = NcbiTaxonomyFromFiles(good_nodes, good_names)
 
    def test_init_good(self):
        """NcbiTaxonomyFromFiles should pass spot-checks of resulting objects"""
    def test_init_bad(self):
        """NcbiTaxonomyFromFiles should produce deadbeats by default"""
        bad_tx = NcbiTaxonomyFromFiles(bad_nodes, good_names)
        self.assertEqual(len(bad_tx.Deadbeats), 2)
        assert 777 in bad_tx.Deadbeats
    def test_init_strict(self):
        """NcbiTaxonomyFromFiles should fail if strict and deadbeats exist"""
        tx = NcbiTaxonomyFromFiles(good_nodes, good_names, strict=True)
        self.assertRaises(MissingParentError, NcbiTaxonomyFromFiles, \
            bad_nodes, good_names, strict=True)
'5555|z||scientific name|',
]
        tx = NcbiTaxonomyFromFiles(nested_species, nested_names)
        dec = tx[3].getRankedDescendants('superclass')
        self.assertEqual(len(dec), 1)