Skip to content
Snippets Groups Projects
Commit db678c7e authored by Stefano Borini's avatar Stefano Borini
Browse files

Added test for send_to_mco

parent 4988002d
No related branches found
No related tags found
1 merge request!68Introduced data value object
import unittest
from force_bdss.core.data_value import DataValue
try:
import mock
except ImportError:
......@@ -34,3 +36,16 @@ class TestDakotaCommunicator(unittest.TestCase):
self.assertEqual(len(data), 1)
self.assertEqual(data[0].value, 1)
self.assertEqual(data[0].type, "")
def test_send_to_mco(self):
bundle = DummyDakotaBundle(mock.Mock(spec=Plugin))
model = bundle.create_model()
comm = bundle.create_communicator()
with mock.patch("sys.stdout") as stdout:
dv = DataValue(value=100)
comm.send_to_mco(model, [dv, dv])
self.assertEqual(stdout.write.call_args[0][0], '100 100')
comm.send_to_mco(model, [])
self.assertEqual(stdout.write.call_args[0][0], '')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment