示例#1
0
def test_dataset():
    d = nycdb.Dataset('pluto_16v2', args=ARGS)

    assert d.name == 'pluto_16v2'
    assert d.dataset == nycdb.datasets()['pluto_16v2']
    assert isinstance(d.files, list)
    assert len(d.files) == 1
    assert isinstance(d.files[0], nycdb.File)
示例#2
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'
示例#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_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'
示例#5
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)
示例#6
0
def test_datasets():
    assert type(nycdb.datasets()) is dict
    assert type(nycdb.datasets()['pluto_16v2']) is dict