Example #1
0
def test_from_s3():
    # note we don't test connection modes with aws_access_key and
    # aws_secret_key because these are not on travis-ci
    boto = pytest.importorskip('boto')

    five_tips = (u'total_bill,tip,sex,smoker,day,time,size\n',
                 u'16.99,1.01,Female,No,Sun,Dinner,2\n',
                 u'10.34,1.66,Male,No,Sun,Dinner,3\n',
                 u'21.01,3.5,Male,No,Sun,Dinner,3\n',
                 u'23.68,3.31,Male,No,Sun,Dinner,2\n')

    # test compressed data
    e = db.from_s3('tip-data', 't*.gz')
    assert e.take(5) == five_tips

    # test wit specific key
    b = db.from_s3('tip-data', 't?ps.csv')
    assert b.npartitions == 1

    # test all keys in bucket
    c = db.from_s3('tip-data')
    assert c.npartitions == 4

    d = db.from_s3('s3://tip-data')
    assert d.npartitions == 4

    e = db.from_s3('tip-data', 'tips.bz2')
    assert e.take(5) == five_tips
Example #2
0
def test_from_s3():
    # note we don't test connection modes with aws_access_key and
    # aws_secret_key because these are not on travis-ci
    boto = pytest.importorskip('boto')

    five_tips = (u'total_bill,tip,sex,smoker,day,time,size\n',
                 u'16.99,1.01,Female,No,Sun,Dinner,2\n',
                 u'10.34,1.66,Male,No,Sun,Dinner,3\n',
                 u'21.01,3.5,Male,No,Sun,Dinner,3\n',
                 u'23.68,3.31,Male,No,Sun,Dinner,2\n')

    # test compressed data
    e = db.from_s3('tip-data', 't*.gz')
    assert e.take(5) == five_tips

    # test wit specific key
    b = db.from_s3('tip-data', 't?ps.csv')
    assert b.npartitions == 1

    # test all keys in bucket
    c = db.from_s3('tip-data')
    assert c.npartitions == 4

    d = db.from_s3('s3://tip-data')
    assert d.npartitions == 4

    e = db.from_s3('tip-data', 'tips.bz2')
    assert e.take(5) == five_tips