Did I find the right examples for you? yes no

All Samples(20)  |  Call(16)  |  Derive(0)  |  Import(4)

src/c/o/cogent-1.5.3/tests/test_util/test_transform.py   cogent(Download)
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import identity
from cogent.util.transform import apply_each, bools, bool_each, \
    conjoin, all, both,\
    disjoin, any, either, negate, none, neither, compose, compose_many, \
    def test_find_any(self):
        """find_any should be True if one of the words is in the string"""
 
        f = find_any('ab')
        self.assertEqual(f(''),0) #empty
 
        # works on any sequence
        f = find_any(['foo','bar'])
        self.assertEqual(f("joe"),0)
        self.assertEqual(f("only foo"),1)

src/p/y/pycogent-HEAD/tests/test_util/test_transform.py   pycogent(Download)
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import identity
from cogent.util.transform import apply_each, bools, bool_each, \
    conjoin, all, both,\
    disjoin, any, either, negate, none, neither, compose, compose_many, \
    def test_find_any(self):
        """find_any should be True if one of the words is in the string"""
 
        f = find_any('ab')
        self.assertEqual(f(''),0) #empty
 
        # works on any sequence
        f = find_any(['foo','bar'])
        self.assertEqual(f("joe"),0)
        self.assertEqual(f("only foo"),1)

src/c/o/cogent-1.5.3/tests/test_util/test_organizer.py   cogent(Download)
 
from cogent.util.organizer import Filter, Organizer, GroupList, regroup
from cogent.util.transform import find_any, find_no, find_all,\
    keep_if_more, exclude_if_more, keep_if_more_other, exclude_if_more_other
from cogent.util.unit_test import TestCase,main
 
        f = Filter('valid',{None:[find_all('AGCU'),find_no('N')],\
                            'Gene':[find_any(['LSU'])]})
        self.assertEqual(f(seq1),True)
        self.assertEqual(f(seq2),False)
    def setUp(self):
        """Define some standard Organizers for testing"""
        self.Empty = Organizer([])
 
        self.a = Filter('a',{None:[find_any('a')]})
        self.b = Filter('b',{None:[find_any('b')]})
        self.Ab_org = Organizer([self.a,self.b])
 
        lsu = Filter('LSU',{None:[exclude_if_more('N',5)],\
                            'Gene':[find_any(['LSU'])]})

src/p/y/pycogent-HEAD/tests/test_util/test_organizer.py   pycogent(Download)
 
from cogent.util.organizer import Filter, Organizer, GroupList, regroup
from cogent.util.transform import find_any, find_no, find_all,\
    keep_if_more, exclude_if_more, keep_if_more_other, exclude_if_more_other
from cogent.util.unit_test import TestCase,main
 
        f = Filter('valid',{None:[find_all('AGCU'),find_no('N')],\
                            'Gene':[find_any(['LSU'])]})
        self.assertEqual(f(seq1),True)
        self.assertEqual(f(seq2),False)
    def setUp(self):
        """Define some standard Organizers for testing"""
        self.Empty = Organizer([])
 
        self.a = Filter('a',{None:[find_any('a')]})
        self.b = Filter('b',{None:[find_any('b')]})
        self.Ab_org = Organizer([self.a,self.b])
 
        lsu = Filter('LSU',{None:[exclude_if_more('N',5)],\
                            'Gene':[find_any(['LSU'])]})