mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +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
|
import pytest
|
||||||
from utils.s3 import read_dataframe_from_s3_parquet
|
from utils.s3 import read_dataframe_from_s3_parquet
|
||||||
from etl.epc.Record import EPCRecord
|
from etl.epc.Record import EPCRecord
|
||||||
|
|
@ -7,13 +8,12 @@ import random
|
||||||
|
|
||||||
class TestEpcRecord:
|
class TestEpcRecord:
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture
|
||||||
def cleaning_data(self):
|
def cleaning_data(self):
|
||||||
cleaning_data = read_dataframe_from_s3_parquet(
|
with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f:
|
||||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
data = pickle.load(f)
|
||||||
)
|
|
||||||
|
|
||||||
return cleaning_data
|
return data
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def epc_records_1(self):
|
def epc_records_1(self):
|
||||||
|
|
@ -262,7 +262,7 @@ class TestEpcRecord:
|
||||||
record.full_sap_epc = []
|
record.full_sap_epc = []
|
||||||
record._clean_number_lighting_outlets()
|
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):
|
def test_clean_count_variables(self, cleaning_data):
|
||||||
record = EPCRecord(cleaning_data=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
|
from datetime import datetime
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import msgpack
|
import pickle
|
||||||
from utils.s3 import read_dataframe_from_s3_parquet, read_from_s3
|
|
||||||
import pytest
|
import pytest
|
||||||
from backend.Property import Property
|
from backend.Property import Property
|
||||||
from etl.epc.Record import EPCRecord
|
from etl.epc.Record import EPCRecord
|
||||||
|
|
@ -14,18 +13,16 @@ class TestHeatingRecommendations:
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def cleaning_data(self):
|
def cleaning_data(self):
|
||||||
return read_dataframe_from_s3_parquet(
|
with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f:
|
||||||
bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet",
|
data = pickle.load(f)
|
||||||
)
|
|
||||||
|
return data
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def cleaned(self):
|
def cleaned(self):
|
||||||
df = read_from_s3(
|
with open("recommendations/tests/test_data/cleaned.pkl", "rb") as f:
|
||||||
s3_file_name="cleaned_epc_data/cleaned.bson",
|
df = pickle.load(f)
|
||||||
bucket_name="retrofit-data-dev"
|
|
||||||
)
|
|
||||||
|
|
||||||
df = msgpack.unpackb(df, raw=False)
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue