From ed733f07ba921317b1246933fdb9a7afccb08e6d Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Thu, 4 Mar 2021 21:33:14 -0800 Subject: [PATCH] Move tests back one level. Update links to badges --- .github/workflows/test.yml | 4 +-- README.md | 6 ++-- terminal.py | 28 +++++++++++-------- .../tests => tests}/__init__.py | 0 .../tests => tests}/test_dd_finviz_api.py | 0 .../test_discovery_fidelity_api.py | 0 .../test_discovery_short_interest_api.py | 0 .../test_fa_business_insider_api.py | 0 .../test_fa_market_watch_api.py | 0 .../test_fa_yahoo_finance_api.py | 0 .../test_pred_neural_networks.py | 0 .../test_sentiment_twitter_api.py | 0 12 files changed, 20 insertions(+), 18 deletions(-) rename {gamestonk_terminal/tests => tests}/__init__.py (100%) rename {gamestonk_terminal/tests => tests}/test_dd_finviz_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_discovery_fidelity_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_discovery_short_interest_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_fa_business_insider_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_fa_market_watch_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_fa_yahoo_finance_api.py (100%) rename {gamestonk_terminal/tests => tests}/test_pred_neural_networks.py (100%) rename {gamestonk_terminal/tests => tests}/test_sentiment_twitter_api.py (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e956e47227..f4c83f46d01 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,7 +68,7 @@ jobs: MPLBACKEND: Agg run: | source $VENV - pytest gamestonk_terminal/tests/ + pytest tests/ tests: needs: test runs-on: ${{ matrix.os }} @@ -116,4 +116,4 @@ jobs: MPLBACKEND: Agg run: | source $VENV - pytest gamestonk_terminal/tests/ + pytest tests/ diff --git a/README.md b/README.md index 6a31fbe3b25..5007bca0402 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # GamestonkTerminal 🚀 -[![Build Status](https://api.travis-ci.org/aia/GamestonkTerminal.svg?branch=main)](https://travis-ci.org/aia/GamestonkTerminal) -[![GitHub release](https://img.shields.io/github/release/aia/GamestonkTerminal.svg?maxAge=3600)](https://github.com/aia/GamestonkTerminal/releases) +[![Build Status](https://github.com/DidierRLopes/GamestonkTerminal/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/DidierRLopes/GamestonkTerminal/actions) +[![GitHub release](https://img.shields.io/github/release/DidierRLopes/GamestonkTerminal.svg?maxAge=3600)](https://github.com/DidierRLopes/GamestonkTerminal/releases) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ## About @@ -74,7 +74,6 @@ Command|Description|Source `spachero` |great website for SPACs research |[SpacHero](https://www.spachero.com/) `uwhales` |good website for SPACs research |[UnusualWhales](https://unusualwhales.com/) - ### [Market Sentiment](gamestonk_terminal/sentiment/README.md) Command|Description @@ -196,7 +195,6 @@ Command|Explanation|Source `short` |short interest |[Quandl](https://www.quandl.com/) `warnings` |company warnings according to Sean Seah book |[MarketWatch](https://www.marketwatch.com/) - ### [Prediction Techniques](gamestonk_terminal/prediction_techniques/README.md) Command|Technique|Sources diff --git a/terminal.py b/terminal.py index 871b78756a1..3efda8bdc3e 100644 --- a/terminal.py +++ b/terminal.py @@ -451,18 +451,22 @@ def main(): b_quit = pm.pred_menu(df_stock, s_ticker, s_start, s_interval) # If stock data is intradaily, we need to get data again as prediction techniques work on daily adjusted data else: - ts = TimeSeries(key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas") - - # pylint: disable=unbalanced-tuple-unpacking - df_stock_pred, _ = ts.get_daily_adjusted( - symbol=s_ticker, outputsize="full" - ) - # pylint: disable=no-member - df_stock_pred = df_stock_pred.sort_index(ascending=True) - df_stock_pred = df_stock_pred[s_start:] - b_quit = pm.pred_menu( - df_stock_pred, s_ticker, s_start, s_interval="1440min" - ) + try: + ts = TimeSeries( + key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas" + ) + df_stock_pred, _ = ts.get_daily_adjusted( + symbol=s_ticker, outputsize="full" + ) + df_stock_pred = df_stock_pred.sort_index(ascending=True) + df_stock_pred = df_stock_pred[s_start:] + b_quit = pm.pred_menu( + df_stock_pred, s_ticker, s_start, s_interval="1440min" + ) + except: + print("Either the ticker or the API_KEY are invalids. Try again!") + b_quit = False + return if b_quit: print( diff --git a/gamestonk_terminal/tests/__init__.py b/tests/__init__.py similarity index 100% rename from gamestonk_terminal/tests/__init__.py rename to tests/__init__.py diff --git a/gamestonk_terminal/tests/test_dd_finviz_api.py b/tests/test_dd_finviz_api.py similarity index 100% rename from gamestonk_terminal/tests/test_dd_finviz_api.py rename to tests/test_dd_finviz_api.py diff --git a/gamestonk_terminal/tests/test_discovery_fidelity_api.py b/tests/test_discovery_fidelity_api.py similarity index 100% rename from gamestonk_terminal/tests/test_discovery_fidelity_api.py rename to tests/test_discovery_fidelity_api.py diff --git a/gamestonk_terminal/tests/test_discovery_short_interest_api.py b/tests/test_discovery_short_interest_api.py similarity index 100% rename from gamestonk_terminal/tests/test_discovery_short_interest_api.py rename to tests/test_discovery_short_interest_api.py diff --git a/gamestonk_terminal/tests/test_fa_business_insider_api.py b/tests/test_fa_business_insider_api.py similarity index 100% rename from gamestonk_terminal/tests/test_fa_business_insider_api.py rename to tests/test_fa_business_insider_api.py diff --git a/gamestonk_terminal/tests/test_fa_market_watch_api.py b/tests/test_fa_market_watch_api.py similarity index 100% rename from gamestonk_terminal/tests/test_fa_market_watch_api.py rename to tests/test_fa_market_watch_api.py diff --git a/gamestonk_terminal/tests/test_fa_yahoo_finance_api.py b/tests/test_fa_yahoo_finance_api.py similarity index 100% rename from gamestonk_terminal/tests/test_fa_yahoo_finance_api.py rename to tests/test_fa_yahoo_finance_api.py diff --git a/gamestonk_terminal/tests/test_pred_neural_networks.py b/tests/test_pred_neural_networks.py similarity index 100% rename from gamestonk_terminal/tests/test_pred_neural_networks.py rename to tests/test_pred_neural_networks.py diff --git a/gamestonk_terminal/tests/test_sentiment_twitter_api.py b/tests/test_sentiment_twitter_api.py similarity index 100% rename from gamestonk_terminal/tests/test_sentiment_twitter_api.py rename to tests/test_sentiment_twitter_api.py