mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
#4467 Python: Add async + classification tests for Case property/NNC APIs
Cover the remaining gaps in the Case Properties + NNC test batch: grid_property_async, nnc_connections_async, and available_properties for DYNAMIC_NATIVE and GENERATED branches. Closes #4467.
This commit is contained in:
1 parent
86d11f42fd
commit
ce3f2935d9
2 files changed
+57
No files matched your search
@@ -61,6 +61,27 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
assert new_data[i] == new_prop_vals[i]
|
||||
|
||||
|
||||
def test_10k_nnc_connections_async(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
accumulated = []
|
||||
chunk_count = 0
|
||||
for chunk in case.nnc_connections_async():
|
||||
accumulated.extend(chunk.connections)
|
||||
chunk_count += 1
|
||||
assert chunk_count > 0
|
||||
|
||||
sync_connections = case.nnc_connections()
|
||||
assert len(accumulated) == len(sync_connections)
|
||||
|
||||
first = accumulated[0]
|
||||
assert first.cell1.i == 33
|
||||
assert first.cell1.j == 40
|
||||
assert first.cell1.k == 14
|
||||
assert first.cell_grid_index1 == 0
|
||||
|
||||
|
||||
def test_non_existing_dynamic_values(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
@@ -184,6 +184,42 @@ def test_10k_property_strings(rips_instance, initialize_test):
|
||||
assert len(round_trip) == len(integer_values)
|
||||
|
||||
|
||||
def test_10k_grid_property_async(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
chunks = case.grid_property_async(rips.PropertyType.STATIC_NATIVE, "PORO", 0)
|
||||
accumulated = []
|
||||
chunk_count = 0
|
||||
for chunk in chunks:
|
||||
accumulated.extend(chunk.values)
|
||||
chunk_count += 1
|
||||
assert chunk_count > 0
|
||||
|
||||
sync_values = case.grid_property(rips.PropertyType.STATIC_NATIVE, "PORO", 0)
|
||||
assert len(accumulated) == len(sync_values)
|
||||
for async_value, sync_value in zip(accumulated, sync_values):
|
||||
assert async_value == pytest.approx(sync_value)
|
||||
|
||||
|
||||
def test_10k_available_properties_categories(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
dynamic = case.available_properties(rips.PropertyType.DYNAMIC_NATIVE)
|
||||
assert "SOIL" in dynamic
|
||||
assert "PRESSURE" in dynamic
|
||||
|
||||
cell_count_info = case.cell_count()
|
||||
zeros = [0.0] * cell_count_info.active_cell_count
|
||||
case.set_active_cell_property(
|
||||
zeros, rips.PropertyType.GENERATED, "AVAILABLE_PROBE", 0
|
||||
)
|
||||
|
||||
generated = case.available_properties(rips.PropertyType.GENERATED)
|
||||
assert "AVAILABLE_PROBE" in generated
|
||||
|
||||
|
||||
def test_exportPropertyInView(rips_instance, initialize_test):
|
||||
case_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(case_path)
|
||||
|
||||
Reference in new issue
Block a user