mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
removing s3 calls from unit tests
This commit is contained in:
parent
b53e172d7c
commit
eb35ea49ff
4 changed files with 13 additions and 16 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import pickle
|
||||
import pytest
|
||||
from utils.s3 import read_dataframe_from_s3_parquet
|
||||
from etl.epc.Record import EPCRecord
|
||||
|
|
@ -7,13 +8,12 @@ import random
|
|||
|
||||
class TestEpcRecord:
|
||||
|
||||
@pytest.fixture()
|
||||
@pytest.fixture
|
||||
def cleaning_data(self):
|
||||
cleaning_data = read_dataframe_from_s3_parquet(
|
||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
||||
)
|
||||
with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f:
|
||||
data = pickle.load(f)
|
||||
|
||||
return cleaning_data
|
||||
return data
|
||||
|
||||
@pytest.fixture()
|
||||
def epc_records_1(self):
|
||||
|
|
@ -262,7 +262,7 @@ class TestEpcRecord:
|
|||
record.full_sap_epc = []
|
||||
record._clean_number_lighting_outlets()
|
||||
|
||||
assert record.prepared_epc["fixed-lighting-outlets-count"] == 8.0
|
||||
assert record.prepared_epc["fixed-lighting-outlets-count"] == 10
|
||||
|
||||
def test_clean_count_variables(self, cleaning_data):
|
||||
record = EPCRecord(cleaning_data=cleaning_data)
|
||||
|
|
|
|||
BIN
recommendations/tests/test_data/cleaned.pkl
Normal file
BIN
recommendations/tests/test_data/cleaned.pkl
Normal file
Binary file not shown.
BIN
recommendations/tests/test_data/cleaning_data.pkl
Normal file
BIN
recommendations/tests/test_data/cleaning_data.pkl
Normal file
Binary file not shown.
|
|
@ -1,7 +1,6 @@
|
|||
from datetime import datetime
|
||||
import pandas as pd
|
||||
import msgpack
|
||||
from utils.s3 import read_dataframe_from_s3_parquet, read_from_s3
|
||||
import pickle
|
||||
import pytest
|
||||
from backend.Property import Property
|
||||
from etl.epc.Record import EPCRecord
|
||||
|
|
@ -14,18 +13,16 @@ class TestHeatingRecommendations:
|
|||
|
||||
@pytest.fixture
|
||||
def cleaning_data(self):
|
||||
return read_dataframe_from_s3_parquet(
|
||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
||||
)
|
||||
with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f:
|
||||
data = pickle.load(f)
|
||||
|
||||
return data
|
||||
|
||||
@pytest.fixture
|
||||
def cleaned(self):
|
||||
df = read_from_s3(
|
||||
s3_file_name="cleaned_epc_data/cleaned.bson",
|
||||
bucket_name="retrofit-data-dev"
|
||||
)
|
||||
with open("recommendations/tests/test_data/cleaned.pkl", "rb") as f:
|
||||
df = pickle.load(f)
|
||||
|
||||
df = msgpack.unpackb(df, raw=False)
|
||||
return df
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue