From 24f44c1c64f5487558cdd4b1cea5652e20de94e3 Mon Sep 17 00:00:00 2001 From: Steinar Foss Date: Wed, 19 Jun 2019 14:06:20 +0200 Subject: [PATCH] sunbeam test connections.py works for new Well2. --- python/tests/connection.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/python/tests/connection.py b/python/tests/connection.py index 6f9b3cf3f..21d92eb9b 100644 --- a/python/tests/connection.py +++ b/python/tests/connection.py @@ -7,41 +7,41 @@ class TestWells(unittest.TestCase): def setUpClass(cls): cls.sch = sunbeam.parse('spe3/SPE3CASE1.DATA').schedule cls.timesteps = cls.sch.timesteps - cls.wells = cls.sch.wells def test_connection_pos(self): - p00 = self.wells[0].connections(0)[0].pos - p01 = self.wells[0].connections(0)[1].pos - p10 = self.wells[1].connections(0)[0].pos - p11 = self.wells[1].connections(0)[1].pos + 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 well in self.wells: - for timestep,_ in enumerate(self.timesteps): - for connection in well.connections(timestep): + 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.wells[0].connections(0) + 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 well in self.wells: - for timestep,_ in enumerate(self.timesteps): - for connection in well.connections(timestep): + 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 well in self.wells: - for timestep,_ in enumerate(self.timesteps): - for connection in well.connections(timestep): + 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__":