Ejemplo n.º 1
0
def test_rowlengths():
    """Test the rowlengths function."""

    table = (('foo', 'bar', 'baz'), ('A', 1, 2), ('B', '2', '3.4'),
             (u'B', u'3', u'7.8', True), ('D', 'xyz', 9.0), ('E', None), ('F',
                                                                          9))
    actual = rowlengths(table)
    expect = (('length', 'count'), (3, 3), (2, 2), (4, 1))
    ieq(expect, actual)
Ejemplo n.º 2
0
def test_rowlengths():
    """Test the rowlengths function."""

    table = (('foo', 'bar', 'baz'),
             ('A', 1, 2),
             ('B', '2', '3.4'),
             ('B', '3', '7.8', True),
             ('D', 'xyz', 9.0),
             ('E', None),
             ('F', 9))
    actual = rowlengths(table)
    expect = (('length', 'count'), (3, 3), (2, 2), (4, 1))
    ieq(expect, actual) 
Ejemplo n.º 3
0
def test_rowlengths():
    """Test the rowlengths function."""

    table = (
        ("foo", "bar", "baz"),
        ("A", 1, 2),
        ("B", "2", "3.4"),
        (u"B", u"3", u"7.8", True),
        ("D", "xyz", 9.0),
        ("E", None),
        ("F", 9),
    )
    actual = rowlengths(table)
    expect = (("length", "count"), (3, 3), (2, 2), (4, 1))
    ieq(expect, actual)
Ejemplo n.º 4
0
etl.typecounts(table, 'baz')


# stringpatterns()
##################

import petl as etl
table = [['foo', 'bar'],
         ['Mr. Foo', '123-1254'],
         ['Mrs. Bar', '234-1123'],
         ['Mr. Spo', '123-1254'],
         [u'Mr. Baz', u'321 1434'],
         [u'Mrs. Baz', u'321 1434'],
         ['Mr. Quux', '123-1254-XX']]
etl.stringpatterns(table, 'foo')
etl.stringpatterns(table, 'bar')


# rowlengths()
###############

import petl as etl
table = [['foo', 'bar', 'baz'],
         ['A', 1, 2],
         ['B', '2', '3.4'],
         [u'B', u'3', u'7.8', True],
         ['D', 'xyz', 9.0],
         ['E', None],
         ['F', 9]]
etl.rowlengths(table)