mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Tests (#957)
* Addded test * Expanded tests * Improved tests * Improved tests * Reverting to old * Modern problems require modern solutions
This commit is contained in:
@@ -690,86 +690,127 @@ class CreateExcelFA:
|
||||
i[1][0]
|
||||
.at["Cash & Cash Equivalents", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ar0 = float(
|
||||
i[1][0].at["Receivables", i[1][0].columns[j]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Receivables", i[1][0].columns[j]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ar1 = float(
|
||||
i[1][0].at["Receivables", i[1][0].columns[j + 1]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Receivables", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
inv0 = float(
|
||||
i[1][0].at["Inventory", i[1][0].columns[j]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Inventory", i[1][0].columns[j]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
inv1 = float(
|
||||
i[1][0].at["Inventory", i[1][0].columns[j + 1]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Inventory", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ca1 = float(
|
||||
i[1][0]
|
||||
.at["Total Current Assets", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ta0 = float(
|
||||
i[1][0].at["Total Assets", i[1][0].columns[j]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Total Assets", i[1][0].columns[j]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ta1 = float(
|
||||
i[1][0].at["Total Assets", i[1][0].columns[j + 1]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Total Assets", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ap0 = float(
|
||||
i[1][0].at["Accounts Payable", i[1][0].columns[j]].replace(",", "")
|
||||
i[1][0]
|
||||
.at["Accounts Payable", i[1][0].columns[j]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ap1 = float(
|
||||
i[1][0]
|
||||
.at["Accounts Payable", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
cl1 = float(
|
||||
i[1][0]
|
||||
.at["Total Current Liabilities", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
tl1 = float(
|
||||
i[1][0]
|
||||
.at["Total Liabilities", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
te0 = float(
|
||||
i[1][0]
|
||||
.at["Shareholders' Equity", i[1][0].columns[j]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
te1 = float(
|
||||
i[1][0]
|
||||
.at["Shareholders' Equity", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
sls1 = float(
|
||||
i[1][1].at["Revenue", i[1][1].columns[j + 1]].replace(",", "")
|
||||
i[1][1]
|
||||
.at["Revenue", i[1][1].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
cogs1 = float(
|
||||
i[1][1]
|
||||
.at["Cost of Revenue", i[1][1].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
inte1 = float(
|
||||
i[1][1]
|
||||
.at["Interest Expense / Income", i[1][1].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
tax1 = float(
|
||||
i[1][1].at["Income Tax", i[1][1].columns[j + 1]].replace(",", "")
|
||||
i[1][1]
|
||||
.at["Income Tax", i[1][1].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
ni1 = float(
|
||||
i[1][1].at["Net Income", i[1][1].columns[j + 1]].replace(",", "")
|
||||
i[1][1]
|
||||
.at["Net Income", i[1][1].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
pdiv1 = float(
|
||||
i[1][1]
|
||||
.at["Preferred Dividends", i[1][0].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
opcf1 = float(
|
||||
i[1][2]
|
||||
.at["Operating Cash Flow", i[1][2].columns[j + 1]]
|
||||
.replace(",", "")
|
||||
.replace("-", "-0")
|
||||
)
|
||||
|
||||
dcf_model.set_cell(
|
||||
|
||||
39
tests/cassettes/test_cryptocurrency/test_dd_controller.yaml
vendored
Normal file
39
tests/cassettes/test_cryptocurrency/test_dd_controller.yaml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate, br
|
||||
Connection:
|
||||
- keep-alive
|
||||
User-Agent:
|
||||
- python-requests/2.26.0
|
||||
method: GET
|
||||
uri: https://api.glassnode.com/v1/metrics/addresses/active_count?api_key=REPLACE_ME&a=BTC&i=24h&s=1605675600&u=1637211600
|
||||
response:
|
||||
body:
|
||||
string: "<html>\r\n<head><title>401 Authorization Required</title></head>\r\n<body>\r\n<center><h1>401
|
||||
Authorization Required</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
|
||||
headers:
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Origin:
|
||||
- https://studio.glassnode.com
|
||||
Access-Control-Expose-Headers:
|
||||
- X-Glassnode-Code
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '172'
|
||||
Content-Type:
|
||||
- text/html
|
||||
Date:
|
||||
- Thu, 18 Nov 2021 16:47:40 GMT
|
||||
Strict-Transport-Security:
|
||||
- max-age=15724800; includeSubDomains
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
version: 1
|
||||
19634
tests/cassettes/test_fa/dcf_view.yaml
vendored
Normal file
19634
tests/cassettes/test_fa/dcf_view.yaml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
31
tests/test_cryptocurrency/test_dd_controller.py
Normal file
31
tests/test_cryptocurrency/test_dd_controller.py
Normal file
@@ -0,0 +1,31 @@
|
||||
""" crpytocurrency/due_diligence/dd_controller.py tests """
|
||||
import unittest
|
||||
|
||||
import vcr
|
||||
|
||||
from gamestonk_terminal.cryptocurrency.due_diligence import dd_controller
|
||||
from tests.helpers import check_print
|
||||
|
||||
|
||||
class TestDDController(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.cont = dd_controller.DueDiligenceController(source="cp", symbol="BTC")
|
||||
|
||||
@check_print(assert_in="Due Diligence:")
|
||||
def test_help(self):
|
||||
self.cont.call_help(None)
|
||||
|
||||
@check_print(assert_in="Moving back to")
|
||||
def test_q(self):
|
||||
self.cont.call_q(None)
|
||||
|
||||
def test_quit(self):
|
||||
self.assertTrue(self.cont.call_quit(None))
|
||||
|
||||
@vcr.use_cassette(
|
||||
"tests/cassettes/test_cryptocurrency/test_dd_controller.yaml",
|
||||
record_mode="new_episodes",
|
||||
)
|
||||
@check_print(assert_in="glassnode")
|
||||
def test_active(self):
|
||||
self.cont.call_active(None)
|
||||
Reference in New Issue
Block a user