def test_bert_embeddings():
    event = nuclio.Event(body=json.dumps(['John loves Mary']))
    ctx = nuclio.Context()
    init_context(ctx)
    outputs = pickle.loads(handler(ctx, event))
    assert (True if abs(np.mean(outputs[0]) - -0.011996539) <= 0.0001 else
            False) is True
    assert (True
            if abs(np.mean(outputs[0]) - -0.011996539) > 0 else False) is True
Example #2
0
def fake_nuclio_context(body, headers=None):
    return nuclio.Context(), nuclio.Event(body=body, headers=headers)
def test_bert_embeddings():
    event = nuclio.Event(body=json.dumps(['John loves Mary']))
    ctx = nuclio.Context()
    init_context(ctx)
    outputs = pickle.loads(handler(ctx, event))
    print(outputs)