Example #1
0
def test_save_no_clf(mock_method):
    mm = modelmanager.ModelManager()
    mm.save(TEST_FILENAME)
    assert mock_method.call_count == 0
Example #2
0
def test_save(mock_method):
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    mm.save(TEST_FILENAME)
    assert mock_method.call_count == 1
Example #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)
Example #4
0
def test_propabilities_no_clf():
    mm = modelmanager.ModelManager()
    prediction = mm.probabilities(['ssdfsaf dsfsadfds dsfsdafsd'])
    assert prediction is None
Example #5
0
def test_predict():
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    prediction = mm.predict(['ssdfsaf dsfsadfds dsfsdafsd'])
    assert prediction
    assert isinstance(prediction[0], str)
Example #6
0
def test_load_validationset(mock_method):
    mm = modelmanager.ModelManager()
    mm.load_validationset(TEST_FILENAME)
    assert mock_method.call_count == 1
Example #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)
Example #8
0
def test_init():
    mm = modelmanager.ModelManager(filename='sgdcmodel.pickle')
    assert mm.clf is not None
    assert isinstance(mm.clf, Pipeline)
Example #9
0
def test_init_no_file():
    mm = modelmanager.ModelManager()
    assert mm.clf is None