Buckets:

download
raw
1.15 kB
import pytest
from example.endpoints_package1.house_price.schema.payload import HousePredictionPayload
from example.endpoints_package1.house_price.schema.prediction import HousePredictionResult
from example.endpoints_package1.house_price.service.implement import HousePriceModel
from example.endpoints_package1.house_price import config
def test_prediction(test_client) -> None:
model_path = config.DEFAULT_MODEL_PATH
hpp = HousePredictionPayload.parse_obj({
"median_income_in_block": 8.3252,
"median_house_age_in_block": 41,
"average_rooms": 6,
"average_bedrooms": 1,
"population_per_block": 322,
"average_house_occupancy": 2.55,
"block_latitude": 37.88,
"block_longitude": -122.23
})
hpm = HousePriceModel(model_path)
result = hpm.predict(hpp)
assert isinstance(result, HousePredictionResult)
def test_prediction_no_payload(test_client) -> None:
model_path = config.DEFAULT_MODEL_PATH
hpm = HousePriceModel(model_path)
with pytest.raises(ValueError):
result = hpm.predict(None)
assert isinstance(result, HousePredictionResult)

Xet Storage Details

Size:
1.15 kB
·
Xet hash:
cf7e7549e14f6d3b92d2f2057ebbd7c59dfb78aecd419dfee34347bb8c33dbf4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.