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_record.py   cogent(Download)
#!/usr/bin/env python
"""Unit tests for parser support libraries dealing with records.
"""
from cogent.parse.record import FieldError, RecordError, Grouper, \
    DelimitedSplitter, GenericRecord, MappedRecord, \
    def test_default(self):
        """Default StrictFieldWrapper should wrap fields if count correct"""
        fields = list('abcde')
        f = StrictFieldWrapper(fields)
        self.assertEqual(f('1   2\t\t 3  \n4 5 '), \
    def test_splitter(self):
        """StrictFieldWrapper with splitter should use that splitter"""
        fields = ['label', 'count']
        splitter = DelimitedSplitter(':', -1)
        f = StrictFieldWrapper(fields, splitter)
    def test_constructor(self):
        """StrictFieldWrapper with constructor should use that constructor"""
        fields = list('ab')
        f = StrictFieldWrapper(fields, constructor=fake_dict)
        self.assertEqual(f('x y'), {'a':'x','b':'y'})
        assert isinstance(f('x y'), fake_dict)

src/p/y/pycogent-HEAD/tests/test_parse/test_record.py   pycogent(Download)
#!/usr/bin/env python
"""Unit tests for parser support libraries dealing with records.
"""
from cogent.parse.record import FieldError, RecordError, Grouper, \
    DelimitedSplitter, GenericRecord, MappedRecord, \
    def test_default(self):
        """Default StrictFieldWrapper should wrap fields if count correct"""
        fields = list('abcde')
        f = StrictFieldWrapper(fields)
        self.assertEqual(f('1   2\t\t 3  \n4 5 '), \
    def test_splitter(self):
        """StrictFieldWrapper with splitter should use that splitter"""
        fields = ['label', 'count']
        splitter = DelimitedSplitter(':', -1)
        f = StrictFieldWrapper(fields, splitter)
    def test_constructor(self):
        """StrictFieldWrapper with constructor should use that constructor"""
        fields = list('ab')
        f = StrictFieldWrapper(fields, constructor=fake_dict)
        self.assertEqual(f('x y'), {'a':'x','b':'y'})
        assert isinstance(f('x y'), fake_dict)