Files
OpenBB/tests/test_discovery/test_discovery_fidelity_api.py
colin99d ce457314a0 Improved Discount Rate Calculation for DCF (#697)
* Added tests ReadMe

* Added warning

* Moved testing docs

* Fixed formatting

* Added a CF tie-out warning and handling for negative firm value

* Added treasury API

* Updated t-bill from API

* Finished better risk understanding

* Finished better risk understanding

* Requested changes

* Updated

* Updated filename

Co-authored-by: Colin Delahunty <colindelahunty@colins-air.attlocal.net>
Co-authored-by: Colin Delahunty <colindelahunty@Colins-MacBook-Air.local>
2021-08-22 01:23:44 +01:00

49 lines
1.4 KiB
Python

""" discovery/fidelity_api.py tests """
import unittest
import vcr
from gamestonk_terminal.stocks.discovery.fidelity_view import (
buy_sell_ratio_color_red_green,
orders_view,
price_change_color_red_green,
)
from tests.helpers import check_print
class TestDiscoveryFidelityApi(unittest.TestCase):
@check_print(assert_in="Symbol")
@vcr.use_cassette(
"tests/cassettes/test_discovery/test_discovery_fidelity/test_orders.yaml",
record_mode="new_episodes",
)
def test_orders(self):
orders_view(5, "")
@vcr.use_cassette(
"tests/cassettes/test_discovery/test_discovery_fidelity/test_buy_sell.yaml",
record_mode="new_episodes",
)
def test_buy_sell_ratio_color_red_green(self):
res = buy_sell_ratio_color_red_green("56% Buys, 44% Sells")
assert res == "\x1b[32m56%\x1b[0m Buys, 44% Sells"
res = buy_sell_ratio_color_red_green("44% Buys, 56% Sells")
assert res == "44% Buys, \x1b[31m56%\x1b[0m Sells"
@vcr.use_cassette(
"tests/cassettes/test_discovery/test_discovery_fidelity/test_price_change_color.yaml",
record_mode="new_episodes",
)
def test_price_change_color_red_green(self):
res = price_change_color_red_green("-6.99 (-6.4288%)")
assert res == "\x1b[31m-6.99 (-6.4288%)\x1b[0m"
res = price_change_color_red_green("2.40 (+124.3523%)")
assert res == "\x1b[32m2.40 (+124.3523%)\x1b[0m"