diff --git a/ApplicationCode/GrpcInterface/Python/rips/tests/test_commands.py b/ApplicationCode/GrpcInterface/Python/rips/tests/test_commands.py index c5f88482fe..a5aafd798b 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/tests/test_commands.py +++ b/ApplicationCode/GrpcInterface/Python/rips/tests/test_commands.py @@ -2,6 +2,7 @@ import sys import os import tempfile import pytest +import grpc sys.path.insert(1, os.path.join(sys.path[0], '../../')) import rips @@ -49,4 +50,9 @@ def test_exportFlowCharacteristics(rips_instance, initializeTest): with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname: print("Temporary folder: ", tmpdirname) fileName = tmpdirname + "/exportFlowChar.txt" - rips_instance.commands.exportFlowCharacteristics(caseId=0, timeSteps=8, producers=[], injectors = "I01", fileName = fileName) \ No newline at end of file + rips_instance.commands.exportFlowCharacteristics(caseId=0, timeSteps=8, producers=[], injectors = "I01", fileName = fileName) + +def test_loadNonExistingCase(rips_instance, initializeTest): + casePath = "Nonsense/Nonsense/Nonsense" + with pytest.raises(grpc.RpcError): + assert rips_instance.project.loadCase(casePath) diff --git a/ApplicationCode/GrpcInterface/Python/rips/tests/test_properties.py b/ApplicationCode/GrpcInterface/Python/rips/tests/test_properties.py index a363d74f3b..fba9d6c125 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/tests/test_properties.py +++ b/ApplicationCode/GrpcInterface/Python/rips/tests/test_properties.py @@ -1,5 +1,6 @@ import sys import os +import grpc import pytest sys.path.insert(1, os.path.join(sys.path[0], '../../')) @@ -33,6 +34,32 @@ def test_10kSync(rips_instance, initializeTest): assert(average != pytest.approx(0.0158893, abs=0.0000001)) assert(average == pytest.approx(0.0558893, abs=0.0000001)) +def test_10k_set(rips_instance, initializeTest): + casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.loadCase(path=casePath) + + results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1) + case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1) + +def test_10k_set_out_of_bounds(rips_instance, initializeTest): + casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.loadCase(path=casePath) + + results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1) + results.append(5.0) + with pytest.raises(grpc.RpcError): + assert case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1) + +def test_10k_set_out_of_bounds_client(rips_instance, initializeTest): + casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.loadCase(path=casePath) + + results = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', 1) + case.properties.chunkSize = len(results) + results.append(5.0) + with pytest.raises(IndexError): + assert case.properties.setActiveCellProperty(results, 'GENERATED', 'SOIL', 1) + def createResult(poroChunks, permxChunks): for (poroChunk, permxChunk) in zip(poroChunks, permxChunks): resultChunk = []