def test_typecounts():

    table = (('foo', 'bar', 'baz'),
             (b'A', 1, 2.),
             (b'B', u'2', 3.4),
             (u'B', u'3', 7.8, True),
             (b'D', u'xyz', 9.0),
             (b'E', 42))

    actual = typecounts(table, 'foo')
    if PY2:
        expect = (('type', 'count', 'frequency'),
                  ('str', 4, 4./5),
                  ('unicode', 1, 1./5))
    else:
        expect = (('type', 'count', 'frequency'),
                  ('bytes', 4, 4./5),
                  ('str', 1, 1./5))
    ieq(expect, actual)

    actual = typecounts(table, 'bar')
    if PY2:
        expect = (('type', 'count', 'frequency'),
                  ('unicode', 3, 3./5),
                  ('int', 2, 5/2.))
    else:
        expect = (('type', 'count', 'frequency'),
                  ('str', 3, 3./5),
                  ('int', 2, 2./5))
    ieq(expect, actual)

    actual = typecounts(table, 'baz')
    expect = (('type', 'count', 'frequency'),
              ('float', 4, 4./5),
              ('NoneType', 1, 1./5))
    ieq(expect, actual)
dataset/ETHPy150Open alimanfoo/petl/petl/test/util/test_counting.py/test_typecounts/swapped operands of `/`