示例#1
0
def test_correct_bbl_typecast_for_pluto():
    t = typecast.Typecast(nycdb.datasets()['pluto_16v2']['schema'])
    assert t.cast['bbl']('1008300028') == '1008300028'
    assert t.cast['bbl']('1008300028.00') == '1008300028'
示例#2
0
def test_typecast_generate_cast():
    t = typecast.Typecast(nycdb.datasets()['hpd_complaints']['schema'][0])
    assert t.cast['boroughid']('123') == 123
    assert t.cast['borough'](' test  ') == 'test'
    assert t.cast['bbl']('0123456789X') == '0123456789'
示例#3
0
def test_cast_row():
    t = typecast.Typecast(nycdb.datasets()['hpd_complaints']['schema'][0])
    row = {'BoroughID': '123', 'Status': 'GOOD'}
    assert t.cast_row(row) == {'BoroughID': 123, 'Status': 'GOOD'}
示例#4
0
def test_typecast_init():
    t = typecast.Typecast(nycdb.datasets()['pluto_16v2']['schema'])

    assert isinstance(t.fields, dict)
    assert t.fields['block'] == 'integer'
    assert isinstance(t.cast, dict)