From ac79064340c839b2c298d73b931f12629a5cbe7e Mon Sep 17 00:00:00 2001 From: mferrera Date: Thu, 19 Dec 2024 11:41:56 +0100 Subject: [PATCH] TST: Check required inplace volumes columns --- src/fmu/dataio/_products/inplace_volumes.py | 2 +- .../test_export_rms/test_export_rms_volumetrics.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/fmu/dataio/_products/inplace_volumes.py b/src/fmu/dataio/_products/inplace_volumes.py index f3acf4350..f7b5c4828 100644 --- a/src/fmu/dataio/_products/inplace_volumes.py +++ b/src/fmu/dataio/_products/inplace_volumes.py @@ -34,7 +34,7 @@ class InplaceVolumesResultRow(BaseModel): BULK: float = Field(ge=0.0) NET: Optional[float] = Field(default=None, ge=0.0) PORV: float = Field(ge=0.0) - HCPV: Optional[float] = Field(default=None, ge=0.0) + HCPV: float = Field(ge=0.0) STOIIP: Optional[float] = Field(default=None, ge=0.0) GIIP: Optional[float] = Field(default=None, ge=0.0) ASSOCIATEDGAS: Optional[float] = Field(default=None, ge=0.0) diff --git a/tests/test_export_rms/test_export_rms_volumetrics.py b/tests/test_export_rms/test_export_rms_volumetrics.py index 9460ba412..f38a1b3c1 100644 --- a/tests/test_export_rms/test_export_rms_volumetrics.py +++ b/tests/test_export_rms/test_export_rms_volumetrics.py @@ -377,10 +377,9 @@ def test_inplace_volumes_export_and_result_columns_are_the_same( ) -def test_that_required_columns_one_to_one_in_enum_and_schema() -> None: - schema_required_fields = [ - name - for name, field in InplaceVolumesResultRow.__fields__.items() - if field.required - ] - assert _enums.InplaceVolumes.required_columns == schema_required_fields +def test_that_required_columns_one_to_one_in_enums_and_schema() -> None: + schema_required_fields = [] + for field_name, field_info in InplaceVolumesResultRow.model_fields.items(): + if field_info.is_required(): + schema_required_fields.append(field_name) + assert _enums.InplaceVolumes.required_columns() == schema_required_fields