Skip to content

Commit

Permalink
Merge pull request #1 from MarekOzana/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
MarekOzana authored Jul 24, 2024
2 parents 8da7759 + 4194db8 commit 399d116
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
Binary file modified data/t_exp.parquet
Binary file not shown.
Binary file modified data/t_keyfigures.parquet
Binary file not shown.
Binary file modified data/t_price.parquet
Binary file not shown.
3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]
pythonpath = .
addopts = --cov=. --cov-config=.coveragerc --cov-report=term --cov-report=html
addopts = --cov=. --cov-config=.coveragerc --cov-report=term --cov-report=html
filterwarnings = ignore:.*google.protobuf.pyext._message.ScalarMapContainer.*:DeprecationWarning
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
altair>=5.3
filelock>=3.13
numpy>=1.26.4
filelock>=3.15
numpy>=2.0.1
pandas>=2.2.2
polars>=0.20.19
pytest>=8.1.1
polars>=1.2.1
pytest>=8.3.1
pytest-cov>=5.0.0
scipy>=1.12.0
streamlit>=1.33
yfinance>=0.2.37
scipy>=1.14.0
streamlit>=1.36
yfinance>=0.2.41
4 changes: 2 additions & 2 deletions src/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,15 @@ def _import_fund_info(self, f_name: Path) -> pl.LazyFrame:
# rating = ix -> moodys -> sp -> fitch
pl.col("ix_rtg")
.fill_null(pl.col("rtg_moody"))
.map_elements(lambda x: self.MOODY_TO_SP.get(x))
.map_elements(lambda x: self.MOODY_TO_SP.get(x), return_dtype=pl.String)
.fill_null(pl.col("rtg_sp"))
.fill_null(pl.col("rtg_fitch"))
.cast(self.RATING_TYPE)
.alias("rating"),
)
.with_columns(
pl.col("rating")
.map_elements(lambda x: self.RATING_TO_MRATING.get(x))
.map_elements(lambda x: self.RATING_TO_MRATING.get(x), return_dtype=pl.String)
.cast(self.MRATING_TYPE)
.alias("m_rating")
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_app_with_adjusted_r_min():
# Initial check to ensure the app started correctly.
assert not at.exception, "The app should start without exceptions."
assert "**Expected Return in 1y** = 7.0%" in at.markdown[0].value
assert "**Expected volatility** = 2.6%" in at.markdown[0].value
assert "**Expected volatility** = 2.5%" in at.markdown[0].value

# Set the r_min slider to 8%.
r_min_slider = at.sidebar.slider[0]
Expand All @@ -31,7 +31,7 @@ def test_app_with_adjusted_r_min():
# Verify that the app didn't throw an exception after the change.
assert not at.exception, "The app should not throw after setting r_min to 8%."
assert "**Expected Return in 1y** = 8.0%" in at.markdown[0].value
assert "**Expected volatility** = 3.9%" in at.markdown[0].value
assert "**Expected volatility** = 3.8%" in at.markdown[0].value


def test_app_remove_tickers():
Expand All @@ -41,11 +41,11 @@ def test_app_remove_tickers():
# Initial check to ensure the app started correctly.
assert not at.exception, "The app should start without exceptions."
assert "**Expected Return in 1y** = 7.0%" in at.markdown[0].value
assert "**Expected volatility** = 2.6%" in at.markdown[0].value
assert "**Expected volatility** = 2.5%" in at.markdown[0].value

at.sidebar.multiselect[0].unselect("Climate Focus").run()

# Verify that the app didn't throw an exception after the change.
assert not at.exception, "The app should not throw removing ticker"
assert "**Expected Return in 1y** = 7.0%" in at.markdown[0].value
assert "**Expected volatility** = 2.9%" in at.markdown[0].value
assert "**Expected volatility** = 2.8%" in at.markdown[0].value

0 comments on commit 399d116

Please sign in to comment.