robertmartin8 / MachineLearningStocks

Using python and scikit-learn to make stock predictions
MIT License
1.74k stars 506 forks source link

Test Failure #20

Closed TardisCoder closed 5 years ago

TardisCoder commented 5 years ago

I get the below error when doing the pytest. I'm not sure why this is occurring.

pytest -vv ================================================================================= test session starts ================================================================================== platform linux -- Python 3.6.5, pytest-3.4.1, py-1.5.3, pluggy-0.6.0 -- /home/chris/anaconda3/bin/python cachedir: .pytest_cache rootdir: /home/chris/Documents/Stocks/MachineLearningStocks, inifile: plugins: remotedata-0.2.1, openfiles-0.3.0, doctestplus-0.1.3, arraydiff-0.2 collected 9 items

tests/test_datasets.py::test_forward_sample_dimensions PASSED [ 11%] tests/test_datasets.py::test_forward_sample_data PASSED [ 22%] tests/test_datasets.py::test_stock_prices_dataset PASSED [ 33%] tests/test_datasets.py::test_stock_prediction_dataset PASSED [ 44%] tests/test_utils.py::test_status_calc PASSED [ 55%] tests/test_utils.py::test_data_string_to_float PASSED [ 66%] tests/test_variables.py::test_statspath PASSED [ 77%] tests/test_variables.py::test_features_same FAILED [ 88%] tests/test_variables.py::test_outperformance PASSED [100%]

======================================================================================= FAILURES ======================================================================================= __ test_features_same __

def test_features_same():
    # There are only four differences (intentionally)
  assert set(parsing_keystats.features) - set(current_data.features) == {'Qtrly Revenue Growth', 'Qtrly Earnings Growth',

'Shares Short (as of', 'Net Income Avl to Common'} E AssertionError: assert {'Net Income ...prior month)'} == {'Net Income A...Short (as of'} E Extra items in the left set: E 'Shares Short (prior month)' E Full diff: E {'Net Income Avl to Common', E 'Qtrly Earnings Growth', E 'Qtrly Revenue Growth', E - 'Shares Short (as of', E ? ^ E + 'Shares Short (as of'} E ? ^ E - 'Shares Short (prior month)'}

tests/test_variables.py:17: AssertionError ========================================================================= 1 failed, 8 passed in 15.02 seconds ==========================================================================

robertmartin8 commented 5 years ago

Thank you very much for running the tests and finding this bug. I think it is occurring because we recently changed the Shares Short string because of a change in Yahoo Finance. I'm gonna have a look at whether it is the test that needs to be change or whether something is actually wrong with the code.

Robert

robertmartin8 commented 5 years ago

I believe I've fixed this with the latest commit. I hope it solves the problem, but let me know if not!

Robert