This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from res.enkf.key_manager import KeyManager | ||
from res.test import ErtTestContext | ||
|
||
from tests import ResTest | ||
|
||
class KeyManagerTest(ResTest): | ||
def setUp(self): | ||
self.config_file = self.createTestPath("local/snake_oil/snake_oil.ert") | ||
|
||
def test_summary_keys(self): | ||
with ErtTestContext("enkf_key_manager_test", self.config_file) as testContext: | ||
ert = testContext.getErt() | ||
key_man = KeyManager(ert) | ||
|
||
self.assertEqual( len(key_man.summaryKeys()), 47) | ||
self.assertTrue("FOPT" in key_man.summaryKeys()) | ||
|
||
self.assertEqual(len(key_man.summaryKeysWithObservations()), 2) | ||
self.assertTrue("FOPR" in key_man.summaryKeysWithObservations()) | ||
self.assertTrue(key_man.isKeyWithObservations("FOPR")) | ||
|
||
|
||
def test_gen_data_keys(self): | ||
with ErtTestContext("enkf_key_manager_test", self.config_file) as testContext: | ||
ert = testContext.getErt() | ||
key_man = KeyManager(ert) | ||
|
||
self.assertEqual( len(key_man.genDataKeys()), 3) | ||
self.assertTrue("SNAKE_OIL_WPR_DIFF@199" in key_man.genDataKeys()) | ||
|
||
self.assertEqual(len(key_man.genDataKeysWithObservations()), 1) | ||
self.assertTrue("SNAKE_OIL_WPR_DIFF@199" in key_man.genDataKeysWithObservations()) | ||
self.assertTrue(key_man.isKeyWithObservations("SNAKE_OIL_WPR_DIFF@199")) | ||
|
||
def test_custom_keys(self): | ||
with ErtTestContext("enkf_key_manager_test", self.config_file) as testContext: | ||
ert = testContext.getErt() | ||
key_man = KeyManager(ert) | ||
|
||
self.assertEqual( len(key_man.customKwKeys()), 2) | ||
self.assertTrue("SNAKE_OIL_NPV:NPV" in key_man.customKwKeys()) | ||
|
||
def test_gen_kw_keys(self): | ||
with ErtTestContext("enkf_key_manager_test", self.config_file) as testContext: | ||
ert = testContext.getErt() | ||
key_man = KeyManager(ert) | ||
|
||
self.assertEqual(len(key_man.genKwKeys()), 10) | ||
self.assertTrue("SNAKE_OIL_PARAM:BPR_555_PERSISTENCE" in key_man.genKwKeys()) |