Skip to content

Commit

Permalink
Add a simple unittest for the FissionYield deepcopy
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmay1 committed Sep 8, 2022
1 parent 2afefba commit 3c7483b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/unit_tests/test_deplete_nuclide.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for the openmc.deplete.Nuclide class."""

import xml.etree.ElementTree as ET

import copy
import numpy as np
import pytest
from openmc.deplete import nuclide
Expand Down Expand Up @@ -335,3 +335,14 @@ def test_validate():
assert "decay mode" in record[0].message.args[0]
assert "0 reaction" in record[1].message.args[0]
assert "1.0" in record[2].message.args[0]


def test_deepcopy():
"""Test deepcopying a FissionYield object"""
nuc = nuclide.FissionYield(products=("I129", "Sm149", "Xe135"), yields=np.array((0.001, 0.0003, 0.002)))
copied_nuc = copy.deepcopy(nuc)
# Check the deepcopy equals the original
assert copied_nuc == nuc
# Mutate the original and verify the copy remains intact
nuc *= 2
assert copied_nuc != nuc

0 comments on commit 3c7483b

Please sign in to comment.