Commit 3cb99504 authored by April Novak's avatar April Novak

Unit tests for getting and setting cell temperature. Refs #1223

parent 18b225f1
......@@ -143,7 +143,7 @@ class Cell(_FortranObjectWithID):
"""
if instance is not None:
instance = c_int32(instance)
instance = c_int32(instance)
T = c_double()
_dll.openmc_cell_get_temperature(self._index, instance, T)
......@@ -160,7 +160,11 @@ class Cell(_FortranObjectWithID):
Which instance of the cell
"""
_dll.openmc_cell_set_temperature(self._index, T, c_int32(instance))
if instance is not None:
instance = c_int32(instance)
_dll.openmc_cell_set_temperature(self._index, T, instance)
class _CellMapping(Mapping):
......
......@@ -75,6 +75,14 @@ def test_cell(capi_init):
assert str(cell) == 'Cell[0]'
def test_cell_temperature(capi_init):
cell = openmc.capi.cells[1]
cell.set_temperature(100.0, 0)
assert cell.get_temperature(0) == 100.0
cell.set_temperature(200)
assert cell.get_temperature() == 200.0
def test_new_cell(capi_init):
with pytest.raises(exc.AllocationError):
openmc.capi.Cell(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment