diff --git a/src/qrules/particle.py b/src/qrules/particle.py index 5f08da1b..fabf2aa4 100644 --- a/src/qrules/particle.py +++ b/src/qrules/particle.py @@ -464,9 +464,7 @@ def create_particle( # pylint: disable=too-many-arguments,too-many-locals if tau_lepton_number else template_particle.tau_lepton_number ), - isospin=( - template_particle.isospin if isospin is None else template_particle.isospin - ), + isospin=template_particle.isospin if isospin is None else isospin, parity=template_particle.parity if parity is None else Parity(parity), c_parity=template_particle.c_parity if c_parity is None else Parity(c_parity), g_parity=template_particle.g_parity if g_parity is None else Parity(g_parity), diff --git a/tests/unit/test_particle.py b/tests/unit/test_particle.py index e4db0de3..35c656e8 100644 --- a/tests/unit/test_particle.py +++ b/tests/unit/test_particle.py @@ -436,6 +436,22 @@ def test_create_particle(particle_database: ParticleCollection, particle_name: s assert new_particle.strangeness == template_particle.strangeness +def test_create_particle_isospin(): + template_particle = Particle( + name="some particle", + pid=0, + spin=0, + mass=3.14, + ) + new_isospin = Spin(0, 0) + new_particle = create_particle( + template_particle, + isospin=new_isospin, + ) + assert template_particle.isospin != new_isospin + assert new_particle.isospin == new_isospin + + def test_get_name_root(particle_database: ParticleCollection): name_roots = {_get_name_root(p.name) for p in particle_database} assert name_roots == {