Files
opm-common/python/tests/test_connection.py
Steinar Foss c208a59597 Sunbeam will be compiled with setuptools.
setup.py moved to python/python.

moved python tests to python/python.

added __init__.py under python/tests.

added 'test_' before all python test names.

test_ prefix added to tests.

setup.py and python tests moved back to python base.

setuptools executes from root python.

python: tests run from root python w/ setup.py.

python tests: temp reduced to test_deck only.

python setup.py: manually linked opmcommon.

setup.py: linked ecl.

setup.py linked boost_filesystem.

setup.py: linked boost_regex.

python all tests run.

removec usr/local from setup.py ext_module.

cmake make copies entire python dir to build.

setup.py can execute from build.

setup.py executes from build/python.

python tests run under setup.py.

setup.py library_dirs and include-dirs set by cmake command.

removed cmake files from sunbeam.

sunbeam: added code for install.

setup.py: removed 'import ecl'.

python/src -> python->src_sunbeam.

setup.py: discontinued use of glob, all files listed instead.

build-opm_module.sh: added prefix_path to opm.

build-opm-module.sh: changed spell error for EXTRA_MODULE_FLAGS[opm-common].

setup.py: infer include directories from cmake target

CMakeLists.txt: under python: align install statement.

CMakeLists build python: removed find_package.

src_sunbeam -> cxx.

setup.py: test_suite as string.

setup.py: tests_suite -> test_suite.

setup.py: added exception if 'build_ext' not used.

temporarily moved files to python/sunbeam.
2019-08-09 10:40:33 +02:00

49 lines
1.7 KiB
Python

import unittest
import sunbeam
class TestWells(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.sch = sunbeam.parse('tests/spe3/SPE3CASE1.DATA').schedule
cls.timesteps = cls.sch.timesteps
def test_connection_pos(self):
wells = self.sch.get_wells(0)
p00 = wells[0].connections()[0].pos
p01 = wells[0].connections()[1].pos
p10 = wells[1].connections()[0].pos
p11 = wells[1].connections()[1].pos
self.assertEqual(p00, (6,6,2))
self.assertEqual(p01, (6,6,3))
self.assertEqual(p10, (0,0,0))
self.assertEqual(p11, (0,0,1))
def test_connection_state(self):
for timestep,_ in enumerate(self.timesteps):
for well in self.sch.get_wells(timestep):
for connection in well.connections():
self.assertEqual("OPEN", connection.state)
def test_filters(self):
flowing = sunbeam.Connection.flowing()
closed = sunbeam.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)
def test_direction(self):
for timestep,_ in enumerate(self.timesteps):
for well in self.sch.get_wells(timestep):
for connection in well.connections():
self.assertEqual(connection.direction, 'Z')
def test_attached_to_segment(self):
for timestep,_ in enumerate(self.timesteps):
for well in self.sch.get_wells(timestep):
for connection in well.connections():
self.assertFalse(connection.attached_to_segment)
if __name__ == "__main__":
unittest.main()