From ba16e0c9c617abe8c3c2439bfb5a557a128187c9 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Mon, 12 Feb 2024 11:00:21 -0600 Subject: [PATCH 1/3] Added # to replicate #363 bug. --- tests/inputs/test.imcnp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/inputs/test.imcnp b/tests/inputs/test.imcnp index 4d9b70e3..fd0d4cbe 100644 --- a/tests/inputs/test.imcnp +++ b/tests/inputs/test.imcnp @@ -4,6 +4,7 @@ foo MCNP Test Model for MOAA C cells +c # hidden vertical Do not touch c 1 1 20 -1000 $ dollar comment From 8970e16766af9e6f9621206559431ae761422fa1 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Mon, 12 Feb 2024 11:16:50 -0600 Subject: [PATCH 2/3] fixed vertical mode detector to ignore comments. --- montepy/input_parser/input_syntax_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/montepy/input_parser/input_syntax_reader.py b/montepy/input_parser/input_syntax_reader.py index 540164a0..84f483fb 100644 --- a/montepy/input_parser/input_syntax_reader.py +++ b/montepy/input_parser/input_syntax_reader.py @@ -186,7 +186,7 @@ def flush_input(): ): yield from flush_input() # die if it is a vertical syntax format - if "#" in line[0:BLANK_SPACE_CONTINUE]: + if "#" in line[0:BLANK_SPACE_CONTINUE] and not line_is_comment: raise errors.UnsupportedFeature("Vertical Input format is not allowed") # cut line down to allowed length old_line = line From a9021da71cc7c7bd3184f2f0c8feb944a5edf196 Mon Sep 17 00:00:00 2001 From: "Micah D. Gale" Date: Mon, 12 Feb 2024 11:17:08 -0600 Subject: [PATCH 3/3] updated test for added comment. --- tests/test_integration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index a43836b5..7e5164af 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -342,6 +342,7 @@ def test_cell_card_pass_through(self): # test input pass-through answer = [ "C cells", + "c # hidden vertical Do not touch", "c", "1 1 20", " -1000 $ dollar comment", @@ -354,20 +355,20 @@ def test_cell_card_pass_through(self): cell = new_prob.cells[1] output = cell.format_for_mcnp_input((6, 2, 0)) print(output) - self.assertEqual(int(output[3].split("$")[0]), -5) + self.assertEqual(int(output[4].split("$")[0]), -5) # test mass density printer cell.mass_density = 10.0 with self.assertWarns(LineExpansionWarning): output = cell.format_for_mcnp_input((6, 2, 0)) print(output) - self.assertAlmostEqual(float(output[2].split()[2]), -10) + self.assertAlmostEqual(float(output[3].split()[2]), -10) # ensure that surface number updated # Test material number change new_prob = copy.deepcopy(problem) new_prob.materials[1].number = 5 cell = new_prob.cells[1] output = cell.format_for_mcnp_input((6, 2, 0)) - self.assertEqual(int(output[2].split()[1]), 5) + self.assertEqual(int(output[3].split()[1]), 5) def test_thermal_scattering_pass_through(self): problem = copy.deepcopy(self.simple_problem)