mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Add a simple unittest for the FissionYield deepcopy
This commit is contained in:
parent
2afefba206
commit
3c7483becb
1 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue