mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
removing online dependency from tests
This commit is contained in:
parent
2838beaa8a
commit
1b15f66f48
2 changed files with 21 additions and 11 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import pickle
|
||||
import pytest
|
||||
from utils.s3 import read_dataframe_from_s3_parquet
|
||||
from etl.epc.Record import EPCRecord
|
||||
from etl.epc.settings import DATA_ANOMALY_MATCHES
|
||||
import random
|
||||
|
|
|
|||
|
|
@ -1,13 +1,27 @@
|
|||
import pytest
|
||||
import pickle
|
||||
from recommendations.WindowsRecommendations import WindowsRecommendations
|
||||
from backend.Property import Property
|
||||
from recommendations.tests.test_data.materials import materials
|
||||
from etl.epc.Record import EPCRecord
|
||||
import msgpack
|
||||
from utils.s3 import read_dataframe_from_s3_parquet, read_from_s3
|
||||
|
||||
|
||||
class TestWindowRecommendations:
|
||||
|
||||
@pytest.fixture()
|
||||
def cleaning_data(self):
|
||||
with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f:
|
||||
data = pickle.load(f)
|
||||
|
||||
return data
|
||||
|
||||
@pytest.fixture()
|
||||
def cleaned(self):
|
||||
with open("recommendations/tests/test_data/cleaned.pkl", "rb") as f:
|
||||
df = pickle.load(f)
|
||||
|
||||
return df
|
||||
|
||||
def test_fully_single_glazed(self):
|
||||
"""
|
||||
For this property, we expect all windows to be single glazed and should recommend full double glazing
|
||||
|
|
@ -18,7 +32,10 @@ class TestWindowRecommendations:
|
|||
"county": "Wychavon",
|
||||
"multi-glaze-proportion": 0,
|
||||
"uprn": 0,
|
||||
"windows-energy-eff": "Very Poor"
|
||||
"windows-energy-eff": "Very Poor",
|
||||
"floor-area": 2.5,
|
||||
"number-habitable-rooms": 5,
|
||||
"number-heated-rooms": 5,
|
||||
}
|
||||
property_1 = Property(
|
||||
id=1,
|
||||
|
|
@ -317,13 +334,7 @@ class TestWindowRecommendations:
|
|||
|
||||
assert not recommender8.recommendation
|
||||
|
||||
def test_simulating_outcome_single_glazed(self):
|
||||
# Could move these to fixtures
|
||||
cleaning_data = read_dataframe_from_s3_parquet(
|
||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
||||
)
|
||||
cleaned = read_from_s3(s3_file_name="cleaned_epc_data/cleaned.bson", bucket_name="retrofit-data-dev")
|
||||
cleaned = msgpack.unpackb(cleaned, raw=False)
|
||||
def test_simulating_outcome_single_glazed(self, cleaning_data, cleaned):
|
||||
|
||||
epc = {
|
||||
'lmk-key': 'f4cf43c90ab3140112a9d1c8cfb21ec1bf73f5a2ca3c75118f289d3447dddf15', 'address1': '3 The Green',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue