diff --git a/python/tests/res/enkf/data/test_gen_kw_config_equinor.py b/python/tests/res/enkf/data/test_gen_kw_config_equinor.py index 4f1452d91b..193e80123a 100644 --- a/python/tests/res/enkf/data/test_gen_kw_config_equinor.py +++ b/python/tests/res/enkf/data/test_gen_kw_config_equinor.py @@ -18,43 +18,34 @@ def test_gen_kw_config(self): ert = context.getErt() - gen_kw_keys = ert.ensembleConfig().getKeylistFromImplType(ErtImplType.GEN_KW) + result_gen_kw_keys = ert.ensembleConfig().getKeylistFromImplType(ErtImplType.GEN_KW) - self.assertEqual(gen_kw_keys[0], "GRID_PARAMS") + expected_keys = ["GRID_PARAMS", "FLUID_PARAMS", "MULTFLT"] - node = ert.ensembleConfig().getNode(gen_kw_keys[0]) - gen_kw_config = node.getModelConfig() - self.assertIsInstance(gen_kw_config, GenKwConfig) + self.assertItemsEqual(result_gen_kw_keys, expected_keys) + self.assertEqual(len(expected_keys), len(result_gen_kw_keys)) - self.assertEqual(gen_kw_config.getKey(), "GRID_PARAMS") - self.assertEqual(len(gen_kw_config), 2) + for key in expected_keys: + node = ert.ensembleConfig().getNode(key) + gen_kw_config = node.getModelConfig() + self.assertIsInstance(gen_kw_config, GenKwConfig) - self.assertEqual(gen_kw_config[0], "MULTPV2") - self.assertEqual(gen_kw_config[1], "MULTPV3") + self.assertEqual(gen_kw_config.getKey(), key) - self.assertFalse(gen_kw_config.shouldUseLogScale(0)) - self.assertFalse(gen_kw_config.shouldUseLogScale(1)) + if key == "GRID_PARAMS": + expected_values = ["MULTPV2", "MULTPV3"] + self.assertFalse(gen_kw_config.shouldUseLogScale(0)) + self.assertFalse(gen_kw_config.shouldUseLogScale(1)) - node = ert.ensembleConfig().getNode(gen_kw_keys[1]) - gen_kw_config = node.getModelConfig() - self.assertIsInstance(gen_kw_config, GenKwConfig) + elif key == "MULTFLT": + expected_values = ["F3"] - self.assertEqual(gen_kw_config.getKey(), "MULTFLT") + self.assertTrue(gen_kw_config.shouldUseLogScale(0)) - self.assertTrue(gen_kw_config.shouldUseLogScale(0)) + elif key == "FLUID_PARAMS": + expected_values = ["SWCR", "SGCR"] + self.assertFalse(gen_kw_config.shouldUseLogScale(0)) + self.assertFalse(gen_kw_config.shouldUseLogScale(1)) - - node = ert.ensembleConfig().getNode(gen_kw_keys[2]) - gen_kw_config = node.getModelConfig() - self.assertIsInstance(gen_kw_config, GenKwConfig) - - self.assertEqual(gen_kw_config.getKey(), "FLUID_PARAMS") - - self.assertFalse(gen_kw_config.shouldUseLogScale(0)) - self.assertFalse(gen_kw_config.shouldUseLogScale(1)) - - expected = ["SWCR", "SGCR"] - - for index, keyword in enumerate(gen_kw_config): - self.assertEqual(keyword, expected[index]) + self.assertEqual([value for value in gen_kw_config], expected_values) \ No newline at end of file