From 0deee483ee6b4248be556577ad3c9da5a93a9139 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Thu, 8 Aug 2024 14:31:46 -0600 Subject: [PATCH 01/17] Update test_isotope_str --- tests/test_material.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_material.py b/tests/test_material.py index aec22336..f37f9ec4 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -223,14 +223,13 @@ def test_isotope_library_setter(self): def test_isotope_str(self): isotope = Isotope("1001.80c") - self.assertEqual(isotope.mcnp_str(), "1001.80c") - self.assertEqual(str(isotope), " H-1 (80c)") - self.assertEqual( - repr(isotope), "ZAID=1001, Z=1, A=1, element=hydrogen, library=80c" - ) + assert isotope.mcnp_str() == "1001.80c" + assert repr(isotope) == "Isotope('1001.80c')" + assert str(isotope) == \ + "ZAID=1001, Z=1, A=1, element=hydrogen, library=80c" isotope = Isotope("94239.80c") - self.assertEqual(isotope.mcnp_str(), "94239.80c") - self.assertEqual(str(isotope), "Pu-239 (80c)") + assert isotope.mcnp_str() == "94239.80c" + assert repr(isotope) == "Isotope('94239.80c')" class TestThermalScattering(TestCase): From b758397038f1b38f0721ca728c270d4e617478fd Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Thu, 8 Aug 2024 14:34:39 -0600 Subject: [PATCH 02/17] Update test_material_str --- tests/test_material.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_material.py b/tests/test_material.py index f37f9ec4..ac897994 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -98,16 +98,17 @@ def test_material_str(self): in_str = "M20 1001.80c 0.5 8016.80c 0.4 94239.80c 0.1" input_card = Input([in_str], BlockType.DATA) material = Material(input_card) - answers = """MATERIAL: 20 fractions: atom - H-1 (80c) 0.5 - O-16 (80c) 0.4 -Pu-239 (80c) 0.1 + answers = """\ +MATERIAL: 20 fractions: atom +ZAID=1001, Z=1, A=1, element=hydrogen, library=80c 0.5 +ZAID=8016, Z=8, A=16, element=oxygen, library=80c 0.4 +ZAID=94239, Z=94, A=239, element=plutonium, library=80c 0.1 """ output = repr(material) print(output) - self.assertEqual(output, answers) + assert output == answers output = str(material) - self.assertEqual(output, "MATERIAL: 20, ['hydrogen', 'oxygen', 'plutonium']") + assert output == "MATERIAL: 20, ['hydrogen', 'oxygen', 'plutonium']" def test_material_sort(self): in_str = "M20 1001.80c 0.5 8016.80c 0.5" From 421d72e43c42e887547de19425dd573fec7cef23 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Thu, 8 Aug 2024 14:36:51 -0600 Subject: [PATCH 03/17] Simplify Isotope repr --- montepy/data_inputs/isotope.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/montepy/data_inputs/isotope.py b/montepy/data_inputs/isotope.py index 4303198d..54db6b06 100644 --- a/montepy/data_inputs/isotope.py +++ b/montepy/data_inputs/isotope.py @@ -166,8 +166,8 @@ def library(self, library): raise TypeError("library must be a string") self._library = library - def __str__(self): - return f"{self.element.symbol:>2}-{self.A:<3} ({self._library})" + def __repr__(self): + return f"{self.__class__.__name__}({repr(self.mcnp_str())})" def mcnp_str(self): """ @@ -191,7 +191,7 @@ def get_base_zaid(self): """ return self.Z * 1000 + self.A - def __repr__(self): + def __str__(self): return f"ZAID={self.ZAID}, Z={self.Z}, A={self.A}, element={self.element}, library={self.library}" def __hash__(self): From 3db662a1c45d4c9af528d7823d6a7f0ba5a6410f Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Thu, 8 Aug 2024 14:37:01 -0600 Subject: [PATCH 04/17] Update changelog --- doc/source/changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index c943806b..7e55c38e 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -8,6 +8,10 @@ MontePy Changelog * Fixed bug with appending and renumbeing numbered objects from other MCNP problems (:issue:`466`). +**Code Quality** + +* Simpler ``Isotope`` representation (:issue:`473`). + 0.3.2 -------------- From 5c010532bec14f6dc1b1160ead2c1f9dec47f5c8 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Thu, 8 Aug 2024 14:42:01 -0600 Subject: [PATCH 05/17] Run "black" on test files as well. --- tests/test_material.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_material.py b/tests/test_material.py index ac897994..ec08fc9e 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -226,8 +226,7 @@ def test_isotope_str(self): isotope = Isotope("1001.80c") assert isotope.mcnp_str() == "1001.80c" assert repr(isotope) == "Isotope('1001.80c')" - assert str(isotope) == \ - "ZAID=1001, Z=1, A=1, element=hydrogen, library=80c" + assert str(isotope) == "ZAID=1001, Z=1, A=1, element=hydrogen, library=80c" isotope = Isotope("94239.80c") assert isotope.mcnp_str() == "94239.80c" assert repr(isotope) == "Isotope('94239.80c')" From 367716feb9c275418f665742b74d384b3fe102fa Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:08:43 -0500 Subject: [PATCH 06/17] Moved init tests to pytest. --- tests/test_material.py | 91 ++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 56 deletions(-) diff --git a/tests/test_material.py b/tests/test_material.py index aec22336..d13bfb21 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -1,5 +1,6 @@ # Copyright 2024, Battelle Energy Alliance, LLC All Rights Reserved. from unittest import TestCase +import pytest import montepy @@ -14,62 +15,6 @@ class testMaterialClass(TestCase): - def test_material_init(self): - # test invalid material number - input_card = Input(["Mfoo"], BlockType.DATA) - with self.assertRaises(MalformedInputError): - Material(input_card) - input_card = Input(["M-20"], BlockType.DATA) - with self.assertRaises(MalformedInputError): - Material(input_card) - - in_str = "M20 1001.80c 0.5 8016.710nc 0.5" - input_card = Input([in_str], BlockType.DATA) - material = Material(input_card) - self.assertEqual(material.number, 20) - self.assertEqual(material.old_number, 20) - self.assertTrue(material.is_atom_fraction) - for component in material.material_components: - self.assertEqual(material.material_components[component].fraction, 0.5) - - # test implicit library with syntax tree errors - in_str = """m1 1001 0.33 - 8016 0.666667""" - input_card = Input(in_str.split("\n"), BlockType.DATA) - material = Material(input_card) - # test implicit library - in_str = "M20 1001 0.5 2001 0.5 8016.710nc 0.5" - input_card = Input([in_str], BlockType.DATA) - material = Material(input_card) - self.assertEqual(material.number, 20) - self.assertEqual(material.old_number, 20) - self.assertTrue(material.is_atom_fraction) - for component in material.material_components: - self.assertEqual(material.material_components[component].fraction, 0.5) - - # test weight fraction - in_str = "M20 1001.80c -0.5 8016.80c -0.5" - input_card = Input([in_str], BlockType.DATA) - material = Material(input_card) - self.assertFalse(material.is_atom_fraction) - for component in material.material_components: - self.assertEqual(material.material_components[component].fraction, 0.5) - - # test bad fraction - in_str = "M20 1001.80c foo" - input_card = Input([in_str], BlockType.DATA) - with self.assertRaises(MalformedInputError): - material = Material(input_card) - # test mismatch fraction - in_str = "M20 1001.80c 0.5 8016.80c -0.5" - input_card = Input([in_str], BlockType.DATA) - with self.assertRaises(MalformedInputError): - material = Material(input_card) - # test parameters - in_str = "M20 1001.80c 0.5 8016.80c 0.5 Gas=1" - input_card = Input([in_str], BlockType.DATA) - material = Material(input_card) - self.assertEqual(material.parameters["gas"]["data"][0].value, 1.0) def test_material_parameter_parsing(self): for line in ["M20 1001.80c 1.0 gas=0", "M20 1001.80c 1.0 gas = 0 nlib = 00c"]: @@ -168,6 +113,40 @@ def test_material_card_pass_through(self): self.assertNotIn("8016", material.format_for_mcnp_input((6, 2, 0))) +@pytest.mark.parametrize( + "line, mat_number, is_atom, fractions", + [ + ("M20 1001.80c 0.5 8016.710nc 0.5", 20, True, [0.5, 0.5]), + ("m1 1001 0.33 8016 0.666667", 1, True, [0.33, 0.666667]), + ("M20 1001 0.5 8016 0.5", 20, True, [0.5, 0.5]), + ("M20 1001.80c -0.5 8016.80c -0.5", 20, False, [0.5, 0.5]), + ("M20 1001.80c -0.5 8016.710nc -0.5", 20, False, [0.5, 0.5]), + ("M20 1001.80c 0.5 8016.80c 0.5 Gas=1", 20, True, [0.5, 0.5]), + ], +) +def test_material_init(line, mat_number, is_atom, fractions): + + input = Input([line], BlockType.DATA) + material = Material(input) + assert material.number == mat_number + assert material.old_number == mat_number + assert material.is_atom_fraction == is_atom + for component, gold in zip(material.material_components.values(), fractions): + assert component.fraction == pytest.approx(gold) + if "gas" in line: + assert material.parameters["gas"]["data"][0].value == pytest.approx(1.0) + + +@pytest.mark.parametrize( + "line", ["Mfoo", "M-20", "M20 1001.80c foo", "M20 1001.80c 0.5 8016.80c -0.5"] +) +def test_bad_init(line): + # test invalid material number + input = Input([line], BlockType.DATA) + with pytest.raises(MalformedInputError): + Material(input) + + class TestIsotope(TestCase): def test_isotope_init(self): isotope = Isotope("1001.80c") From a4d613ff6fa5c74f84208c2ef72614883c78e3c5 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:14:02 -0500 Subject: [PATCH 07/17] Replicated issue #477. --- tests/inputs/test_missing_mat_for_mt.imcnp | 3 +++ tests/test_material.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/tests/inputs/test_missing_mat_for_mt.imcnp b/tests/inputs/test_missing_mat_for_mt.imcnp index 596ddabd..ab5212fa 100644 --- a/tests/inputs/test_missing_mat_for_mt.imcnp +++ b/tests/inputs/test_missing_mat_for_mt.imcnp @@ -6,4 +6,7 @@ c surfaces 1 so 0.5 c data +m5 8016.71c 2.6999999-02 + 8017.71c 9.9999998-01 + plib=84p MT1 lwtr.01t diff --git a/tests/test_material.py b/tests/test_material.py index d13bfb21..4ab86231 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -122,6 +122,12 @@ def test_material_card_pass_through(self): ("M20 1001.80c -0.5 8016.80c -0.5", 20, False, [0.5, 0.5]), ("M20 1001.80c -0.5 8016.710nc -0.5", 20, False, [0.5, 0.5]), ("M20 1001.80c 0.5 8016.80c 0.5 Gas=1", 20, True, [0.5, 0.5]), + ( + "m1 8016.71c 2.6999999-02 8017.71c 9.9999998-01 plib=84p", + 1, + True, + [2.6999999e-2, 9.9999998e-01], + ), ], ) def test_material_init(line, mat_number, is_atom, fractions): From aa41a7b641514b1413c3487089ec80a821315c3a Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:27:12 -0500 Subject: [PATCH 08/17] Stop assuming that the last node is always valid. --- montepy/input_parser/syntax_node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/montepy/input_parser/syntax_node.py b/montepy/input_parser/syntax_node.py index b65dae5f..0432bbd9 100644 --- a/montepy/input_parser/syntax_node.py +++ b/montepy/input_parser/syntax_node.py @@ -193,8 +193,9 @@ def comments(self): def get_trailing_comment(self): if len(self.nodes) == 0: return - tail = next(reversed(self.nodes.items())) - return tail[1].get_trailing_comment() + for node in reversed(self.nodes.values()): + if node is not None: + return node.get_trailing_comment() def _delete_trailing_comment(self): tail = next(reversed(self.nodes.items())) From 1eaedbac5c1507b71968ae1de7d3b0820cc73747 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:28:24 -0500 Subject: [PATCH 09/17] Added issue #477 in changelog. --- doc/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 5af2893e..d1439ba1 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -8,6 +8,7 @@ MontePy Changelog * Fixed bug with appending and renumbering numbered objects from other MCNP problems (:issue:`466`). * Fixed bug with dynamic typing and the parsers that only appear in edge cases (:issue:`461`). +* Fixed bug with trying to get trailing comments from non-existant parts of the syntax tree (:pull:`480`). 0.3.2 From 288f7caa89164019d55d68b52c6b60cfd54905d3 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:45:41 -0500 Subject: [PATCH 10/17] Enabled making a sitemap. --- doc/source/conf.py | 3 +++ pyproject.toml | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 8b083bc9..7c9c158f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -36,12 +36,15 @@ "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx.ext.extlinks", + "sphinx_sitemap", ] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] html_favicon = "monty.svg" html_logo = "monty.svg" + +html_baseurl = "https://www.montepy.org/" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. diff --git a/pyproject.toml b/pyproject.toml index 9069f269..b02c6d8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,12 @@ dependencies = [ [project.optional-dependencies] test = ["coverage[toml]>=6.3.2", "pytest"] # This is needed for a sphinx bug. See #414. -doc = ["sphinx>=7.4.0", "sphinxcontrib-apidoc", "sphinx_rtd_theme"] +doc = [ + "sphinx>=7.4.0", + "sphinxcontrib-apidoc", + "sphinx_rtd_theme", + "sphinx-sitemap" +] format = ["black>=23.3.0"] build = [ "build", From e6382a1cef70a8bba1e5d6f61854e3593944b0b6 Mon Sep 17 00:00:00 2001 From: Micah Gale Date: Fri, 9 Aug 2024 16:45:56 -0500 Subject: [PATCH 11/17] Added robots.txt --- doc/source/conf.py | 1 + doc/source/robots.txt | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 doc/source/robots.txt diff --git a/doc/source/conf.py b/doc/source/conf.py index 7c9c158f..0994542c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -45,6 +45,7 @@ html_logo = "monty.svg" html_baseurl = "https://www.montepy.org/" +html_extra_path = ["robots.txt"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. diff --git a/doc/source/robots.txt b/doc/source/robots.txt new file mode 100644 index 00000000..d2a4758d --- /dev/null +++ b/doc/source/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://www.montepy.org/sitemap.xml From 1aca7868d65807d309b096e23b3690ae35e636d9 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Mon, 12 Aug 2024 09:29:16 -0500 Subject: [PATCH 12/17] Added repostatus badge. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c8165fc4..192de107 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![JOSS article status](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199/status.svg)](https://joss.theoj.org/papers/e5b5dc8cea19605a1507dd4d420d5199) [![Coverage Status](https://coveralls.io/repos/github/idaholab/MontePy/badge.svg?branch=develop)](https://coveralls.io/github/idaholab/MontePy?branch=develop) [![PyPI version](https://badge.fury.io/py/montepy.svg)](https://badge.fury.io/py/montepy) +[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) MontePy is a python library to read, edit, and write MCNP input files. From 0cdc14374a9df49dcd05307da3fbdef289354154 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Mon, 12 Aug 2024 15:35:11 -0600 Subject: [PATCH 13/17] Change Isotope.__repr__() --- montepy/data_inputs/isotope.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/montepy/data_inputs/isotope.py b/montepy/data_inputs/isotope.py index 54db6b06..232ad5fb 100644 --- a/montepy/data_inputs/isotope.py +++ b/montepy/data_inputs/isotope.py @@ -167,7 +167,7 @@ def library(self, library): self._library = library def __repr__(self): - return f"{self.__class__.__name__}({repr(self.mcnp_str())})" + return f"{self.__class__.__name__}({repr(self.nuclide_str())})" def mcnp_str(self): """ @@ -180,6 +180,9 @@ def mcnp_str(self): """ return f"{self.ZAID}.{self.library}" + def nuclide_str(self): + return f"{self.element.symbol}-{self.A}.{self._library}" + def get_base_zaid(self): """ Get the ZAID identifier of the base isotope this is an isomer of. From 080f8ed747ee251df21b5b5a61669867fc6e277f Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Tue, 13 Aug 2024 07:31:40 -0600 Subject: [PATCH 14/17] Isotope.nuclide_str() when no xs lib --- montepy/data_inputs/isotope.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/montepy/data_inputs/isotope.py b/montepy/data_inputs/isotope.py index 232ad5fb..7d1af41c 100644 --- a/montepy/data_inputs/isotope.py +++ b/montepy/data_inputs/isotope.py @@ -181,7 +181,8 @@ def mcnp_str(self): return f"{self.ZAID}.{self.library}" def nuclide_str(self): - return f"{self.element.symbol}-{self.A}.{self._library}" + suffix = f".{self._library}" if self._library else "" + return f"{self.element.symbol}-{self.A}{suffix}" def get_base_zaid(self): """ From 42cb025538dd6764f861fcfe50a6db11c60f2927 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Tue, 13 Aug 2024 08:11:20 -0600 Subject: [PATCH 15/17] Restore old Isotope __str__ --- montepy/data_inputs/isotope.py | 3 ++- tests/test_material.py | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/montepy/data_inputs/isotope.py b/montepy/data_inputs/isotope.py index 7d1af41c..0a1cc158 100644 --- a/montepy/data_inputs/isotope.py +++ b/montepy/data_inputs/isotope.py @@ -196,7 +196,8 @@ def get_base_zaid(self): return self.Z * 1000 + self.A def __str__(self): - return f"ZAID={self.ZAID}, Z={self.Z}, A={self.A}, element={self.element}, library={self.library}" + suffix = f" ({self._library})" if self._library else "" + return f"{self.element.symbol:>2}-{self.A:<3}{suffix}" def __hash__(self): return hash(self._ZAID) diff --git a/tests/test_material.py b/tests/test_material.py index ec08fc9e..f23d5745 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -100,9 +100,9 @@ def test_material_str(self): material = Material(input_card) answers = """\ MATERIAL: 20 fractions: atom -ZAID=1001, Z=1, A=1, element=hydrogen, library=80c 0.5 -ZAID=8016, Z=8, A=16, element=oxygen, library=80c 0.4 -ZAID=94239, Z=94, A=239, element=plutonium, library=80c 0.1 + H-1 (80c) 0.5 + O-16 (80c) 0.4 +Pu-239 (80c) 0.1 """ output = repr(material) print(output) @@ -225,11 +225,11 @@ def test_isotope_library_setter(self): def test_isotope_str(self): isotope = Isotope("1001.80c") assert isotope.mcnp_str() == "1001.80c" - assert repr(isotope) == "Isotope('1001.80c')" - assert str(isotope) == "ZAID=1001, Z=1, A=1, element=hydrogen, library=80c" + assert repr(isotope) == "Isotope('H-1.80c')" + assert str(isotope) == " H-1 (80c)" isotope = Isotope("94239.80c") assert isotope.mcnp_str() == "94239.80c" - assert repr(isotope) == "Isotope('94239.80c')" + assert repr(isotope) == "Isotope('Pu-239.80c')" class TestThermalScattering(TestCase): From 20a664d96ee7b88ffc35c85d20995a4aa4ad48b9 Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Tue, 13 Aug 2024 10:34:34 -0600 Subject: [PATCH 16/17] Consider no library possibility in Isotope.mcnp_str() --- montepy/data_inputs/isotope.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/montepy/data_inputs/isotope.py b/montepy/data_inputs/isotope.py index 0a1cc158..286c5b8c 100644 --- a/montepy/data_inputs/isotope.py +++ b/montepy/data_inputs/isotope.py @@ -178,7 +178,8 @@ def mcnp_str(self): :returns: a string that can be used in MCNP :rtype: str """ - return f"{self.ZAID}.{self.library}" + suffix = f".{self.library}" if self._library else "" + return f"{self.ZAID}{suffix}" def nuclide_str(self): suffix = f".{self._library}" if self._library else "" From 9a1f9f6dfc5b68fc366e5c115a3ffa0e75aa211e Mon Sep 17 00:00:00 2001 From: "Travis J. Labossiere-Hickman" Date: Tue, 13 Aug 2024 10:34:42 -0600 Subject: [PATCH 17/17] Test Isotope.nuclide_str() --- tests/test_material.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_material.py b/tests/test_material.py index f23d5745..83ef1c55 100644 --- a/tests/test_material.py +++ b/tests/test_material.py @@ -225,11 +225,17 @@ def test_isotope_library_setter(self): def test_isotope_str(self): isotope = Isotope("1001.80c") assert isotope.mcnp_str() == "1001.80c" + assert isotope.nuclide_str() == "H-1.80c" assert repr(isotope) == "Isotope('H-1.80c')" assert str(isotope) == " H-1 (80c)" isotope = Isotope("94239.80c") + assert isotope.nuclide_str() == "Pu-239.80c" assert isotope.mcnp_str() == "94239.80c" assert repr(isotope) == "Isotope('Pu-239.80c')" + isotope = Isotope("95642") + assert isotope.nuclide_str() == "Am-242" + assert isotope.mcnp_str() == "95642" + assert repr(isotope) == "Isotope('Am-242')" class TestThermalScattering(TestCase):