""" fundamental_analysis/market_watch_api.py tests """ import unittest from unittest import mock # pylint: disable=unused-import from gamestonk_terminal.test_helper import ( # noqa: F401 parameterize_from_file, pytest_generate_tests, ) from gamestonk_terminal.fundamental_analysis.market_watch_api import ( prepare_df_financials, ) assertions = unittest.TestCase("__init__") class TestFaMarketWatchApiUnit: @mock.patch("gamestonk_terminal.fundamental_analysis.market_watch_api.requests") @parameterize_from_file( "test_prepare_df_financials", "../tests/data/fa_market_watch_api.yaml", ) # pylint: disable=too-many-arguments def test_prepare_df_financials( self, mock_request_get, ticker, statement, mock_market_watch, expected_result ): mock_request_get.get().text = mock_market_watch ret = prepare_df_financials(ticker, statement) assertions.assertEqual.__self__.maxDiff = None assertions.assertEqual( ret.to_csv().replace("\r\n", "\n"), expected_result.replace("\r\n", "\n"), )