Skip to content

Commit

Permalink
modif code
Browse files Browse the repository at this point in the history
  • Loading branch information
juguirlet committed Dec 16, 2023
1 parent 23a9fb0 commit 101f398
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions appli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
from streamlit.testing.v1 import AppTest
from app.app import get_customers_ids, get_customer_values, get_features_selected, request_prediction, construire_jauge_score
import matplotlib.pyplot as plt
import pandas as pd
#import shap

@pytest.fixture
def streamlit_client():
script_path = "app/app.py"

# Initialize the app.
# Initialise l'application
app_test = AppTest.from_file(script_path, default_timeout=3)
# Run the app.
# lance l'appli
app_test.run()

yield app_test
Expand All @@ -29,21 +27,6 @@ def test_get_features_selected(streamlit_client):
features_selected_list = get_features_selected()
assert isinstance(features_selected_list, list)

#def test_get_customer_shap_values(streamlit_client):
# data_df = streamlit_client.cache(lambda: streamlit_client.head(1))()
# shap_values_list, _, _ = get_customer_shap_values(data_df)
# assert isinstance(shap_values_list, list)

def test_request_prediction(streamlit_client):
api_url_calc = f'https://juguirlet.pythonanywhere.com/api/v1/predict'
#data = streamlit_client.cache(lambda: streamlit_client.head(1))()
mock_data = {'column_name': ['mocked_data']}
streamlit_client.dataframe(pd.DataFrame(mock_data))

# Now you can call your request_prediction function with the mocked data
response = request_prediction(api_url_calc, streamlit_client.dataframe)
assert "prediction" in response

def test_construire_jauge_score(streamlit_client):
score_remboursement_client = 0.7
jauge_score = construire_jauge_score(score_remboursement_client)
Expand Down

0 comments on commit 101f398

Please sign in to comment.