From e25416c236d2ab6621c9f74393956d72881cf081 Mon Sep 17 00:00:00 2001 From: Steinar Foss Date: Mon, 12 Aug 2019 08:36:00 +0200 Subject: [PATCH] renamed python pkg sunbeam -> opm. setup.py: test_suite -> tests_suite . libsunbeam -> libopmcommon_python. sunbeam -> opm: test_connection ok. test_deck ok. test_group_tree ok. test_grupnet ok. test_parse_deck.py ok. test_parse.py ok. python all tests ok. --- CMakeLists.txt | 14 +++++------ python/cxx/sunbeam.cpp | 2 +- python/python/{sunbeam => opm}/__init__.py | 4 ++-- python/python/{sunbeam => opm}/config.py | 2 +- python/python/opm/deck/__init__.py | 2 ++ python/python/{sunbeam => opm}/parser.py | 2 +- python/python/{sunbeam => opm}/properties.py | 2 +- python/python/{sunbeam => opm}/schedule.py | 2 +- python/python/{sunbeam => opm}/sunbeam.py | 0 .../python/{sunbeam => opm}/tools/__init__.py | 0 .../{sunbeam => opm}/tools/time_vector.py | 12 +++++----- python/python/sunbeam/deck/__init__.py | 2 -- python/setup.py | 12 +++++----- python/tests/test_connection.py | 8 +++---- python/tests/test_deck.py | 6 ++--- python/tests/test_group_tree.py | 6 ++--- python/tests/test_grupnet.py | 4 ++-- python/tests/test_parse.py | 24 +++++++++---------- python/tests/test_parse_deck.py | 16 ++++++------- python/tests/test_props.py | 4 ++-- python/tests/test_schedule.py | 8 +++---- python/tests/test_state.py | 12 +++++----- python/tests/test_time_vector.py | 6 ++--- python/tests/test_wells.py | 22 ++++++++--------- 24 files changed, 86 insertions(+), 86 deletions(-) rename python/python/{sunbeam => opm}/__init__.py (67%) rename python/python/{sunbeam => opm}/config.py (87%) create mode 100644 python/python/opm/deck/__init__.py rename python/python/{sunbeam => opm}/parser.py (99%) rename python/python/{sunbeam => opm}/properties.py (98%) rename python/python/{sunbeam => opm}/schedule.py (98%) rename python/python/{sunbeam => opm}/sunbeam.py (100%) rename python/python/{sunbeam => opm}/tools/__init__.py (100%) rename python/python/{sunbeam => opm}/tools/time_vector.py (97%) delete mode 100644 python/python/sunbeam/deck/__init__.py diff --git a/CMakeLists.txt b/CMakeLists.txt index d6ac429f7..0d0df2ebf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ if (OPM_ENABLE_PYTHON) else() set( PYTHON_PACKAGE_PATH "site-packages") endif() - set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}/sunbeam" CACHE STRING "Subdirectory to install Python modules in") + set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}/opm" CACHE STRING "Subdirectory to install Python modules in") get_target_property(_ecl_include_dirs ecl INTERFACE_INCLUDE_DIRECTORIES) get_target_property(_opmcommon_include_dirs opmcommon INCLUDE_DIRECTORIES) @@ -229,7 +229,7 @@ if (OPM_ENABLE_PYTHON) set(_opmcommon_lib_dirs ${_ecl_lib_dir} ${CMAKE_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/lib) string(REPLACE ";" ":" _setup_lib_dirs "${_opmcommon_lib_dirs}") - add_custom_command(OUTPUT python/python/sunbeam/libsunbeam.so + add_custom_command(OUTPUT python/python/opm/libopmcommon_python.so DEPENDS python/cxx/connection.cpp python/cxx/converters.hpp python/cxx/deck.cpp @@ -252,18 +252,18 @@ if (OPM_ENABLE_PYTHON) COMMAND python ${CMAKE_BINARY_DIR}/python/setup.py build build_ext - --build-lib=${CMAKE_BINARY_DIR}/python/python/sunbeam + --build-lib=${CMAKE_BINARY_DIR}/python/python/opm --library-dirs=${_setup_lib_dirs} --include-dirs=${_setup_include_dirs} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python COMMENT "Building python bindings") - add_custom_target(sunbeam ALL DEPENDS python/python/sunbeam/libsunbeam.so) - add_dependencies(sunbeam opmcommon) - INSTALL( DIRECTORY ${CMAKE_BINARY_DIR}/python/python/sunbeam/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX}) + add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/libopmcommon_python.so) + add_dependencies(opmcommon_python opmcommon) + INSTALL( DIRECTORY ${CMAKE_BINARY_DIR}/python/python/opm/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX}) add_test(NAME python_tests WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python - COMMAND python setup.py build_ext --dry-run --build-lib ${CMAKE_BINARY_DIR}/python/python/sunbeam test + COMMAND python setup.py build_ext --dry-run --build-lib ${CMAKE_BINARY_DIR}/python/python/opm test ) set_target_properties(opmcommon PROPERTIES POSITION_INDEPENDENT_CODE ON) diff --git a/python/cxx/sunbeam.cpp b/python/cxx/sunbeam.cpp index 5c935c6de..4c2678ca5 100644 --- a/python/cxx/sunbeam.cpp +++ b/python/cxx/sunbeam.cpp @@ -2,7 +2,7 @@ #include "sunbeam.hpp" -PYBIND11_MODULE(libsunbeam, module) { +PYBIND11_MODULE(libopmcommon_python, module) { sunbeam::export_Parser(module); sunbeam::export_Deck(module); sunbeam::export_DeckKeyword(module); diff --git a/python/python/sunbeam/__init__.py b/python/python/opm/__init__.py similarity index 67% rename from python/python/sunbeam/__init__.py rename to python/python/opm/__init__.py index d0af60473..052064238 100644 --- a/python/python/sunbeam/__init__.py +++ b/python/python/opm/__init__.py @@ -1,7 +1,7 @@ from __future__ import absolute_import -from .schedule import Well, Connection, Schedule -from .libsunbeam import action +from .schedule import Well, Connection, Schedule +from .libopmcommon_python import action from .config import EclipseConfig from .parser import parse, parse_string diff --git a/python/python/sunbeam/config.py b/python/python/opm/config.py similarity index 87% rename from python/python/sunbeam/config.py rename to python/python/opm/config.py index af9382b1a..4f6544143 100644 --- a/python/python/sunbeam/config.py +++ b/python/python/opm/config.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from sunbeam import libsunbeam as lib +from opm import libopmcommon_python as lib from .sunbeam import delegate @delegate(lib.SummaryConfig) diff --git a/python/python/opm/deck/__init__.py b/python/python/opm/deck/__init__.py new file mode 100644 index 000000000..e5c96f856 --- /dev/null +++ b/python/python/opm/deck/__init__.py @@ -0,0 +1,2 @@ +from opm.parser import load_deck as parse +from opm.parser import load_deck_string as parse_string diff --git a/python/python/sunbeam/parser.py b/python/python/opm/parser.py similarity index 99% rename from python/python/sunbeam/parser.py rename to python/python/opm/parser.py index 92c81a0e4..17afb5e88 100644 --- a/python/python/sunbeam/parser.py +++ b/python/python/opm/parser.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import os.path import json -from sunbeam import libsunbeam as lib +from opm import libopmcommon_python as lib from .properties import SunbeamState diff --git a/python/python/sunbeam/properties.py b/python/python/opm/properties.py similarity index 98% rename from python/python/sunbeam/properties.py rename to python/python/opm/properties.py index 9eec91716..beba04eff 100644 --- a/python/python/sunbeam/properties.py +++ b/python/python/opm/properties.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from os.path import isfile -from sunbeam import libsunbeam as lib +from opm import libopmcommon_python as lib from .sunbeam import delegate from .schedule import Schedule from .config import EclipseConfig diff --git a/python/python/sunbeam/schedule.py b/python/python/opm/schedule.py similarity index 98% rename from python/python/sunbeam/schedule.py rename to python/python/opm/schedule.py index c6f233189..3e247d615 100644 --- a/python/python/sunbeam/schedule.py +++ b/python/python/opm/schedule.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from sunbeam import libsunbeam as lib +from opm import libopmcommon_python as lib from .sunbeam import delegate @delegate(lib.Schedule) diff --git a/python/python/sunbeam/sunbeam.py b/python/python/opm/sunbeam.py similarity index 100% rename from python/python/sunbeam/sunbeam.py rename to python/python/opm/sunbeam.py diff --git a/python/python/sunbeam/tools/__init__.py b/python/python/opm/tools/__init__.py similarity index 100% rename from python/python/sunbeam/tools/__init__.py rename to python/python/opm/tools/__init__.py diff --git a/python/python/sunbeam/tools/time_vector.py b/python/python/opm/tools/time_vector.py similarity index 97% rename from python/python/sunbeam/tools/time_vector.py rename to python/python/opm/tools/time_vector.py index 672650095..871ce98d1 100644 --- a/python/python/sunbeam/tools/time_vector.py +++ b/python/python/opm/tools/time_vector.py @@ -6,7 +6,7 @@ except ImportError: from io import StringIO -import sunbeam.deck +import opm.deck # This is from the TimeMap.cpp implementation in opm ecl_month = {"JAN" : 1, @@ -172,7 +172,7 @@ class TimeVector(object): Basic usage example: #!/usr/bin/env python - from sunbeam.tools import TimeVector + from opm.tools import TimeVector # Create vector and load history. tv = TimeVector( start ) @@ -213,11 +213,11 @@ class TimeVector(object): self._add_dates_block(ts) start_dt = datetime.datetime(start_date.year, start_date.month, start_date.day) if base_file: - deck = sunbeam.deck.parse(base_file) + deck = opm.deck.parse(base_file) self._add_deck(deck, start_dt) if base_string: - deck = sunbeam.deck.parse_string(base_string) + deck = opm.deck.parse_string(base_string) self._add_deck(deck, start_dt) @@ -328,7 +328,7 @@ class TimeVector(object): tv.load("well.sch", date = datetime.datetime(2017, 4, 1)) """ - deck = sunbeam.deck.parse(filename) + deck = opm.deck.parse(filename) self._add_deck(deck, date) @@ -336,7 +336,7 @@ class TimeVector(object): """ Like load() - but load from a string literal instead of file. """ - deck = sunbeam.deck.parse_string(deck_string) + deck = opm.deck.parse_string(deck_string) self._add_deck(deck, date) diff --git a/python/python/sunbeam/deck/__init__.py b/python/python/sunbeam/deck/__init__.py deleted file mode 100644 index ae802d22c..000000000 --- a/python/python/sunbeam/deck/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from sunbeam.parser import load_deck as parse -from sunbeam.parser import load_deck_string as parse_string diff --git a/python/setup.py b/python/setup.py index fc05afb72..1ebe11dea 100644 --- a/python/setup.py +++ b/python/setup.py @@ -22,7 +22,7 @@ if 'build' in sys.argv: ext_modules = [ Extension( - 'libsunbeam', + 'libopmcommon_python', [ 'cxx/connection.cpp', 'cxx/deck.cpp', @@ -48,16 +48,16 @@ ext_modules = [ ] setup( - name='Sunbeam', + name='Opm', package_dir = {'': 'python'}, packages=[ - 'sunbeam', - 'sunbeam.tools', - 'sunbeam.deck', + 'opm', + 'opm.tools', + 'opm.deck', ], ext_modules=ext_modules, license='Open Source', zip_safe=False, - test_suite='tests', + tests_suite='tests', setup_requires=["pytest-runner", 'setuptools_scm'], ) diff --git a/python/tests/test_connection.py b/python/tests/test_connection.py index 7f70ee400..748b70080 100644 --- a/python/tests/test_connection.py +++ b/python/tests/test_connection.py @@ -1,11 +1,11 @@ import unittest -import sunbeam +import opm class TestWells(unittest.TestCase): @classmethod def setUpClass(cls): - cls.sch = sunbeam.parse('tests/spe3/SPE3CASE1.DATA').schedule + cls.sch = opm.parse('tests/spe3/SPE3CASE1.DATA').schedule cls.timesteps = cls.sch.timesteps def test_connection_pos(self): @@ -26,8 +26,8 @@ class TestWells(unittest.TestCase): self.assertEqual("OPEN", connection.state) def test_filters(self): - flowing = sunbeam.Connection.flowing() - closed = sunbeam.Connection.closed() + flowing = opm.Connection.flowing() + closed = opm.Connection.closed() connections = self.sch.get_wells(0)[0].connections() self.assertEqual(len(list(filter(flowing, connections))), 2) self.assertEqual(len(list(filter(closed, connections))), 0) diff --git a/python/tests/test_deck.py b/python/tests/test_deck.py index a97296ccd..77ded704d 100644 --- a/python/tests/test_deck.py +++ b/python/tests/test_deck.py @@ -1,5 +1,5 @@ import unittest -import sunbeam.deck +import opm.deck class TestParse(unittest.TestCase): @@ -27,7 +27,7 @@ FIPNUM """ def setUp(self): - self.deck = sunbeam.deck.parse_string(self.DECK_STRING) + self.deck = opm.deck.parse_string(self.DECK_STRING) def test_deck_in(self): map(lambda kw: self.assertIn(kw, self.deck), [ @@ -49,7 +49,7 @@ FIPNUM str(self.deck['DX']).split() ) self.assertEqual( - str(sunbeam.deck.parse_string('RUNSPEC\n\nDX\n4*0.5 /')).split(), + str(opm.deck.parse_string('RUNSPEC\n\nDX\n4*0.5 /')).split(), 'RUNSPEC DX 0.5 0.5 0.5 0.5 /'.split() ) diff --git a/python/tests/test_group_tree.py b/python/tests/test_group_tree.py index 3a1e437fb..5f9be1f87 100644 --- a/python/tests/test_group_tree.py +++ b/python/tests/test_group_tree.py @@ -1,12 +1,12 @@ import sys import unittest -import sunbeam +import opm class TestGroupTree(unittest.TestCase): def setUp(self): norne = 'examples/data/norne/NORNE_ATW2013.DATA' - self.sch = sunbeam.parse(norne, [('PARSE_RANDOM_SLASH', sunbeam.action.ignore)]).schedule + self.sch = opm.parse(norne, [('PARSE_RANDOM_SLASH', opm.action.ignore)]).schedule def test_group(self): gr = self.sch.group(timestep=2)['PROD'] @@ -35,7 +35,7 @@ class TestGroupTree(unittest.TestCase): group = self.sch.group(timestep=3)['PROD'] children = ['MANI-B1', 'MANI-B2', 'MANI-D1', 'MANI-D2', 'MANI-E1', 'MANI-E2'] names = [child.name for child in group.children] - self.assertEqual(sunbeam.schedule.Group, type(child)) + self.assertEqual(opm.schedule.Group, type(child)) self.assertEqual(set(children), set(names)) if __name__ == '__main__': diff --git a/python/tests/test_grupnet.py b/python/tests/test_grupnet.py index d713dbb5b..2e4967ca3 100644 --- a/python/tests/test_grupnet.py +++ b/python/tests/test_grupnet.py @@ -1,13 +1,13 @@ import sys import unittest -import sunbeam +import opm class TestGrupnet(unittest.TestCase): @classmethod def setUpClass(cls): norne = 'examples/data/norne/NORNE_ATW2013.DATA' - cls.sch = sunbeam.parse(norne, [('PARSE_RANDOM_SLASH', sunbeam.action.ignore)]).schedule + cls.sch = opm.parse(norne, [('PARSE_RANDOM_SLASH', opm.action.ignore)]).schedule def test_vfp_table(self): self.assertEqual(0, self.sch.group(timestep=0)['PROD'].vfp_table_nr) diff --git a/python/tests/test_parse.py b/python/tests/test_parse.py index 30757f518..3678453fb 100644 --- a/python/tests/test_parse.py +++ b/python/tests/test_parse.py @@ -1,5 +1,5 @@ import unittest -import sunbeam +import opm import os.path import sys @@ -33,36 +33,36 @@ FIPNUM self.norne_fname = os.path.abspath('examples/data/norne/NORNE_ATW2013.DATA') def test_parse(self): - spe3 = sunbeam.parse(self.spe3fn) + spe3 = opm.parse(self.spe3fn) self.assertEqual('SPE 3 - CASE 1', spe3.state.title) def test_parse_with_recovery(self): - recovery = [("PARSE_RANDOM_SLASH", sunbeam.action.ignore)] - spe3 = sunbeam.parse(self.spe3fn, recovery=recovery) + recovery = [("PARSE_RANDOM_SLASH", opm.action.ignore)] + spe3 = opm.parse(self.spe3fn, recovery=recovery) def test_parse_with_multiple_recoveries(self): - recoveries = [ ("PARSE_RANDOM_SLASH", sunbeam.action.ignore), - ("FOO", sunbeam.action.warn), - ("PARSE_RANDOM_TEXT", sunbeam.action.throw) ] + recoveries = [ ("PARSE_RANDOM_SLASH", opm.action.ignore), + ("FOO", opm.action.warn), + ("PARSE_RANDOM_TEXT", opm.action.throw) ] - spe3 = sunbeam.parse(self.spe3fn, recovery=recoveries) + spe3 = opm.parse(self.spe3fn, recovery=recoveries) def test_throw_on_invalid_recovery(self): recoveries = [ ("PARSE_RANDOM_SLASH", 3.14 ) ] with self.assertRaises(TypeError): - sunbeam.parse(self.spe3fn, recovery=recoveries) + opm.parse(self.spe3fn, recovery=recoveries) with self.assertRaises(TypeError): - sunbeam.parse(self.spe3fn, recovery="PARSE_RANDOM_SLASH") + opm.parse(self.spe3fn, recovery="PARSE_RANDOM_SLASH") def test_data(self): pass - #regtest = sunbeam.parse(self.REGIONDATA) + #regtest = opm.parse(self.REGIONDATA) #self.assertEqual([3,3,1,2], regtest.props()['OPERNUM']) def test_parse_norne(self): - state = sunbeam.parse(self.norne_fname, recovery=[('PARSE_RANDOM_SLASH', sunbeam.action.ignore)]) + state = opm.parse(self.norne_fname, recovery=[('PARSE_RANDOM_SLASH', opm.action.ignore)]) es = state.state self.assertEqual(46, es.grid().getNX()) self.assertEqual(112, es.grid().getNY()) diff --git a/python/tests/test_parse_deck.py b/python/tests/test_parse_deck.py index be8b1c006..ed7b43bbf 100644 --- a/python/tests/test_parse_deck.py +++ b/python/tests/test_parse_deck.py @@ -1,6 +1,6 @@ import unittest -import sunbeam -import sunbeam.deck +import opm +import opm.deck import os.path class TestParse(unittest.TestCase): @@ -55,22 +55,22 @@ FIPNUM def test_IOError(self): with self.assertRaises(IOError): - sunbeam.parse("file/not/found") + opm.parse("file/not/found") with self.assertRaises(IOError): - sunbeam.deck.parse("/file/not/found") + opm.deck.parse("/file/not/found") def test_parser_fail_without_extension(self): - error_recovery = [("PARSE_RANDOM_SLASH", sunbeam.action.ignore)] + error_recovery = [("PARSE_RANDOM_SLASH", opm.action.ignore)] with self.assertRaises(ValueError): - sunbeam.deck.parse_string(self.DECK_ADDITIONAL_KEYWORDS, + opm.deck.parse_string(self.DECK_ADDITIONAL_KEYWORDS, recovery=error_recovery ) def test_parser_extension(self): - error_recovery = [("PARSE_RANDOM_SLASH", sunbeam.action.ignore)] - deck = sunbeam.deck.parse_string(self.DECK_ADDITIONAL_KEYWORDS, + error_recovery = [("PARSE_RANDOM_SLASH", opm.action.ignore)] + deck = opm.deck.parse_string(self.DECK_ADDITIONAL_KEYWORDS, keywords=self.KEYWORDS, recovery=error_recovery ) self.assertIn( 'TESTKEY0', deck ) diff --git a/python/tests/test_props.py b/python/tests/test_props.py index efe9bae47..9108a7421 100644 --- a/python/tests/test_props.py +++ b/python/tests/test_props.py @@ -1,5 +1,5 @@ import unittest -import sunbeam +import opm class TestProps(unittest.TestCase): @@ -9,7 +9,7 @@ class TestProps(unittest.TestCase): self.assertTrue(diff <= epsilon, msg=err_msg) def setUp(self): - self.spe3 = sunbeam.parse('tests/spe3/SPE3CASE1.DATA').state + self.spe3 = opm.parse('tests/spe3/SPE3CASE1.DATA').state self.props = self.spe3.props() def test_repr(self): diff --git a/python/tests/test_schedule.py b/python/tests/test_schedule.py index c0fe25ae2..e0b959341 100644 --- a/python/tests/test_schedule.py +++ b/python/tests/test_schedule.py @@ -1,13 +1,13 @@ import unittest import datetime as dt -import sunbeam +import opm class TestSchedule(unittest.TestCase): @classmethod def setUpClass(cls): - cls.sch = sunbeam.parse('tests/spe3/SPE3CASE1.DATA').schedule + cls.sch = opm.parse('tests/spe3/SPE3CASE1.DATA').schedule def testWells(self): self.assertEqual(2, len(self.sch.get_wells(0))) @@ -36,8 +36,8 @@ class TestSchedule(unittest.TestCase): def head(xs): return next(iter(xs)) - inje = head(filter(sunbeam.Well.injector(), g1)) - prod = head(filter(sunbeam.Well.producer(), g1)) + inje = head(filter(opm.Well.injector(), g1)) + prod = head(filter(opm.Well.producer(), g1)) self.assertEqual(self.sch.get_well('INJ', 0).isinjector(), inje.isinjector()) self.assertEqual(self.sch.get_well('PROD', 0).isproducer(), prod.isproducer()) diff --git a/python/tests/test_state.py b/python/tests/test_state.py index 77b5421ef..26ed5fbac 100644 --- a/python/tests/test_state.py +++ b/python/tests/test_state.py @@ -1,5 +1,5 @@ import unittest -import sunbeam +import opm class TestState(unittest.TestCase): FAULTS_DECK = """ @@ -49,8 +49,8 @@ SATNUM @classmethod def setUpClass(cls): - cls.spe3 = sunbeam.parse('tests/spe3/SPE3CASE1.DATA') - cpa = sunbeam.parse('tests/data/CORNERPOINT_ACTNUM.DATA') + cls.spe3 = opm.parse('tests/spe3/SPE3CASE1.DATA') + cpa = opm.parse('tests/data/CORNERPOINT_ACTNUM.DATA') cls.state = cls.spe3.state cls.cp_state = cpa.state @@ -124,7 +124,7 @@ SATNUM def test_faults(self): self.assertEquals([], self.state.faultNames()) self.assertEquals({}, self.state.faults()) - faultdeck = sunbeam.parse_string(self.FAULTS_DECK).state + faultdeck = opm.parse_string(self.FAULTS_DECK).state self.assertEqual(['F1', 'F2'], faultdeck.faultNames()) # 'F2' 5 5 1 4 1 4 'X-' / \n" f2 = faultdeck.faultFaces('F2') @@ -139,7 +139,7 @@ SATNUM # jf["OIL_WATER"] = 21.0 # set in deck # jf["GAS_OIL"] = -1.0 # N/A - js = sunbeam.parse('tests/data/JFUNC.DATA').state + js = opm.parse('tests/data/JFUNC.DATA').state self.assertEqual('JFUNC TEST', js.title) jf = js.jfunc() print(jf) @@ -167,7 +167,7 @@ JFUNC GAS * 13.0 0.6 0.7 Z / PROPS\nREGIONS """ - js_gas = sunbeam.parse_string(jfunc_gas).state + js_gas = opm.parse_string(jfunc_gas).state jf = js_gas.jfunc() self.assertEqual(jf['FLAG'], 'GAS') self.assertEqual(jf['DIRECTION'], 'Z') diff --git a/python/tests/test_time_vector.py b/python/tests/test_time_vector.py index 6acd0f3f6..bac080e35 100644 --- a/python/tests/test_time_vector.py +++ b/python/tests/test_time_vector.py @@ -1,7 +1,7 @@ import unittest import datetime -from sunbeam.tools import * -import sunbeam.deck +from opm.tools import * +import opm.deck from utils import tmp class TestTimeVector(unittest.TestCase): @@ -120,7 +120,7 @@ class TestTimeVector(unittest.TestCase): def test_no_leading_DATES(self): tv = TimeVector(datetime.date(1997, 11, 6), base_file="tests/data/schedule/part1.sch") s = str(tv) - d = sunbeam.deck.parse_string(s) + d = opm.deck.parse_string(s) kw0 = d[0] self.assertEqual(kw0.name, "WELSPECS") diff --git a/python/tests/test_wells.py b/python/tests/test_wells.py index 99c534317..fe0b0a46e 100644 --- a/python/tests/test_wells.py +++ b/python/tests/test_wells.py @@ -1,19 +1,19 @@ import unittest -import sunbeam +import opm class TestWells(unittest.TestCase): @classmethod def setUpClass(cls): - cls.sch = sunbeam.parse('tests/spe3/SPE3CASE1.DATA').schedule + cls.sch = opm.parse('tests/spe3/SPE3CASE1.DATA').schedule cls.timesteps = cls.sch.timesteps # cls.wells = cls.sch.wells def inje(self, wells): - return next(iter(filter(sunbeam.Well.injector(), wells))) + return next(iter(filter(opm.Well.injector(), wells))) def prod(self, wells): - return next(iter(filter(sunbeam.Well.producer(), wells))) + return next(iter(filter(opm.Well.producer(), wells))) def testWellPos0(self): wells = self.sch.get_wells(0) @@ -63,14 +63,14 @@ class TestWells(unittest.TestCase): self.assertTrue(prod.available_gctrl()) def testWellDefinedFilter(self): - defined0 = list(filter(sunbeam.Well.defined(0), self.sch.get_wells(0) )) - defined1 = list(filter(sunbeam.Well.defined(1), self.sch.get_wells(1) )) + defined0 = list(filter(opm.Well.defined(0), self.sch.get_wells(0) )) + defined1 = list(filter(opm.Well.defined(1), self.sch.get_wells(1) )) self.assertEqual(len(list(defined0)), 2) self.assertEqual(len(list(defined1)), 2) def testWellProdInjeFilter(self): - inje = list(filter(sunbeam.Well.injector(), self.sch.get_wells(0) )) - prod = list(filter(sunbeam.Well.producer(), self.sch.get_wells(0) )) + inje = list(filter(opm.Well.injector(), self.sch.get_wells(0) )) + prod = list(filter(opm.Well.producer(), self.sch.get_wells(0) )) self.assertEqual(len(inje), 1) self.assertEqual(len(prod), 1) @@ -81,15 +81,15 @@ class TestWells(unittest.TestCase): def testOpenFilter(self): wells = self.sch.get_wells(1) - open_at_1 = sunbeam.Well.flowing() + open_at_1 = opm.Well.flowing() flowing = list(filter(open_at_1, wells)) closed = list(filter(lambda well: not open_at_1(well), wells)) self.assertEqual(2, len(flowing)) self.assertEqual(0, len(closed)) - flowing1 = filter(lambda x: not sunbeam.Well.closed()(x), wells) - closed1 = filter(sunbeam.Well.closed(), wells) + flowing1 = filter(lambda x: not opm.Well.closed()(x), wells) + closed1 = filter(opm.Well.closed(), wells) self.assertListEqual(list(closed), list(closed1)) def testCompletions(self):