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