Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with hidden vertical input mode. #370

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion montepy/input_parser/input_syntax_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,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
Expand Down
1 change: 1 addition & 0 deletions tests/inputs/test.imcnp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down
Loading