Skip to content

Commit 7f7143e

Browse files
committed
pymcnp: updated Inp.to_mcnp
1 parent 0081282 commit 7f7143e

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/pymcnp/Inp.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,18 @@ def to_mcnp(self):
129129
# source += f'c {"cells":^76.76}\n'
130130
# source += DELIMITER
131131

132-
return f"""
133-
{self.message + "\n" if self.message else ""}{self.title}
134-
{'\n'.join(map(str, self.cells))}
135-
136-
{'\n'.join(map(str, self.surfaces))}
137-
138-
{'\n'.join(map(str, self.data))}
139-
140-
{self.other if self.other is not None else ""}
141-
"""[1:-1]
132+
return (
133+
(self.message + '\n' if self.message else '')
134+
+ self.title.value
135+
+ '\n'
136+
+ '\n'.join(map(str, self.cells))
137+
+ '\n\n'
138+
+ '\n'.join(map(str, self.surfaces))
139+
+ '\n\n'
140+
+ '\n'.join(map(str, self.data))
141+
+ '\n\n'
142+
+ (self.other if self.other is not None else '')
143+
)
142144

143145
def draw(self) -> _show.Shape:
144146
"""

tests/test_pymcnp/test__cli/test_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ def test_valid(self):
1414
def test_invalid(self):
1515
os.system(f"pymcnp plot {pathlib.Path(__file__).parent.parent.parent.parent / 'files' / 'outp' / 'invalid_02.outp'} 1")
1616
os.system(f"pymcnp plot {pathlib.Path(__file__).parent.parent.parent.parent / 'files' / 'outp' / 'example_00.outp'} 132423")
17-
os.system("pymcnp plot hello 1")
17+
os.system('pymcnp plot hello 1')
1818
matplotlib.pyplot.close()

tests/test_pymcnp/test__cli/test_visualize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ def test_valid(self):
1212

1313
def test_invalid(self):
1414
os.system(f"pymcnp visualize {pathlib.Path(__file__).parent.parent.parent.parent / 'files' / 'inp' / 'invalid_00.inp'}")
15-
os.system(f"pymcnp visualize hello")
15+
os.system('pymcnp visualize hello')

0 commit comments

Comments
 (0)