mirror of
https://github.com/PR0M3TH3AN/python_charts.git
synced 2026-10-27 08:50:39 +00:00
Add figure size and display options
This commit is contained in:
1 parent
be4256f2fb
commit
34359e51e4
4 files changed
+79
-10
No files matched your search
@@ -32,7 +32,19 @@ def test_btc_m2_main(monkeypatch):
|
||||
return btc, m2
|
||||
|
||||
monkeypatch.setattr("scripts.bitcoin_m2_chart.fetch_series", fake_fetch)
|
||||
fig = btc_m2_main(["--btc-series", "BTC", "--m2-series", "M2"])
|
||||
fig = btc_m2_main([
|
||||
"--btc-series",
|
||||
"BTC",
|
||||
"--m2-series",
|
||||
"M2",
|
||||
"--width",
|
||||
"8",
|
||||
"--height",
|
||||
"4",
|
||||
"--dpi",
|
||||
"150",
|
||||
"--no-show",
|
||||
])
|
||||
assert len(fig.axes) == 2
|
||||
|
||||
|
||||
@@ -52,6 +64,13 @@ def test_btc_m2_main_saves_output(tmp_path, monkeypatch):
|
||||
"M2",
|
||||
"--output",
|
||||
str(out_file),
|
||||
"--width",
|
||||
"8",
|
||||
"--height",
|
||||
"4",
|
||||
"--dpi",
|
||||
"150",
|
||||
"--no-show",
|
||||
]
|
||||
)
|
||||
assert out_file.exists()
|
||||
+16
-1
@@ -8,7 +8,7 @@ import pandas as pd
|
||||
|
||||
sys.path.append(os.path.abspath("."))
|
||||
|
||||
from scripts.lagged_oil_unrate_chart_styled import plot_lagged
|
||||
from scripts.lagged_oil_unrate_chart_styled import plot_lagged, main as lagged_main
|
||||
from scripts.custom_chart import plot_series, main as custom_main
|
||||
|
||||
|
||||
@@ -64,3 +64,18 @@ def test_custom_main_saves_output(tmp_path):
|
||||
]
|
||||
)
|
||||
assert out_file.exists()
|
||||
|
||||
|
||||
def test_lagged_main_options(monkeypatch):
|
||||
dates = pd.date_range("2021-01-01", periods=3, freq="M")
|
||||
unrate = pd.DataFrame({"value": [1, 2, 3]}, index=dates)
|
||||
oil = pd.DataFrame({"value": [4, 5, 6]}, index=dates)
|
||||
|
||||
monkeypatch.setattr(
|
||||
"scripts.lagged_oil_unrate_chart_styled.fetch_series", lambda *_: (unrate, oil)
|
||||
)
|
||||
|
||||
fig = lagged_main(
|
||||
["--offset", "1", "--width", "8", "--height", "4", "--dpi", "150", "--no-show"]
|
||||
)
|
||||
assert len(fig.axes) == 2
|
||||
Reference in new issue
Block a user