Exemplo n.º 1
0
def test_call_step_two_step_three_guests(mock_client):
    # Leveraging Object-based DB that we refactored out from Level-1
    sync_one = SyncAirbnb(mock_client, DBObject())
    sync_one(2)
    sync_one(3)

    sync_two = SyncAirbnb(mock_client, DBObject())
    sync_two(3)

    assert len(sync_one.guests) & len(sync_two.guests)
    assert sync_one.guests == sync_two.guests
Exemplo n.º 2
0
def test_call_step_one_step_two_messages(mock_client):
    # Leveraging Object-based DB that we refactored out from Level-1
    sync_one = SyncAirbnb(mock_client, DBObject())
    sync_one(1)
    sync_one(2)

    sync_two = SyncAirbnb(mock_client, DBObject())
    sync_two(2)

    assert len(sync_one.messages) & len(sync_two.messages)
    assert sync_one.messages == sync_two.messages
Exemplo n.º 3
0
def insert_features(path, table):
    batches, predictions = get_batch_predictions(path)

    name2vector = {}
    for i, prediction in enumerate(predictions):
        name2vector[batches.filenames[i].split('/')[-1]] = prediction

    db = DBObject(db=DB_NAME, user=USER, password=PASSWORD)
    save_to_db(table, name2vector, db)