Пример #1
0
def test_save_no_clf(mock_method):
    mm = modelmanager.ModelManager()
    mm.save(TEST_FILENAME)
    assert mock_method.call_count == 0
Пример #2
0
def test_save(mock_method):
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    mm.save(TEST_FILENAME)
    assert mock_method.call_count == 1
Пример #3
0
def test_propabilities():
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    prediction = mm.probabilities(['ssdfsaf dsfsadfds dsfsdafsd'])
    assert prediction is not None
    assert isinstance(prediction[0], ndarray)
Пример #4
0
def test_propabilities_no_clf():
    mm = modelmanager.ModelManager()
    prediction = mm.probabilities(['ssdfsaf dsfsadfds dsfsdafsd'])
    assert prediction is None
Пример #5
0
def test_predict():
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    prediction = mm.predict(['ssdfsaf dsfsadfds dsfsdafsd'])
    assert prediction
    assert isinstance(prediction[0], str)
Пример #6
0
def test_load_validationset(mock_method):
    mm = modelmanager.ModelManager()
    mm.load_validationset(TEST_FILENAME)
    assert mock_method.call_count == 1
Пример #7
0
def test_load(filename='sgdcmodel.pickle'):
    mm = modelmanager.ModelManager()
    assert mm.clf is None
    mm.clf = mm.load('sgdcmodel.pickle')
    assert isinstance(mm.clf, Pipeline)
Пример #8
0
def test_init():
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    assert mm.clf is not None
    assert isinstance(mm.clf, Pipeline)
Пример #9
0
def test_init_no_file():
    mm = modelmanager.ModelManager()
    assert mm.clf is None