mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 20:42:26 +00:00
* 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>
49 lines
1.4 KiB
Python
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"
|