Ejemplo n.º 1
0
def test_convertall():

    table1 = (('foo', 'bar', 'baz'), ('1', '3', '9'), ('2', '1', '7'))
    table2 = convertall(table1, int)
    expect2 = (('foo', 'bar', 'baz'), (1, 3, 9), (2, 1, 7))
    ieq(expect2, table2)
    ieq(expect2, table2)

    # test with non-string field names
    table1 = (('foo', 3, 4), (2, 2, 2))
    table2 = convertall(table1, lambda x: x**2)
    expect = (('foo', 3, 4), (4, 4, 4))
    ieq(expect, table2)
Ejemplo n.º 2
0
def test_convertall():

    table1 = (('foo', 'bar', 'baz'), ('1', '3', '9'), ('2', '1', '7'))
    table2 = convertall(table1, int)
    expect2 = (('foo', 'bar', 'baz'), (1, 3, 9), (2, 1, 7))
    ieq(expect2, table2)
    ieq(expect2, table2)
Ejemplo n.º 3
0
def test_convertall():

    table1 = (('foo', 'bar', 'baz'),
              ('1', '3', '9'),
              ('2', '1', '7'))
    table2 = convertall(table1, int)
    expect2 = (('foo', 'bar', 'baz'),
               (1, 3, 9),
               (2, 1, 7))
    ieq(expect2, table2)
    ieq(expect2, table2)