Skip to content

Commit

Permalink
Merge pull request #143 from ukaea/develop
Browse files Browse the repository at this point in the history
adding extra line at end of mat card
  • Loading branch information
shimwell authored May 3, 2021
2 parents 19ae4a1 + fdb1e37 commit 637dd5c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion neutronics_material_maker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def make_mcnp_material(mat) -> str:

mat_card = mat_card + add_additional_end_lines('mcnp', mat)

return "\n".join(mat_card)
return "\n".join(mat_card) + '\n'


def make_shift_material(mat) -> str:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="neutronics_material_maker",
version="0.3.3",
version="0.3.4",
summary="Package for making material cards for neutronics codes",
author="neutronics_material_maker development team",
author_email="[email protected]",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_Material.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_mcnp_material_lines(self):
)
line_by_line_material = test_material.mcnp_material.split("\n")

assert len(line_by_line_material) == 12
assert len(line_by_line_material) == 13

assert line_by_line_material[0].split()[0] == "c"
assert line_by_line_material[0].split()[1] == "Nb3Sn"
Expand Down Expand Up @@ -239,7 +239,7 @@ def test_mcnp_material_lines_with_decimal_places(self):
)
line_by_line_material = test_material.mcnp_material.split("\n")

assert len(line_by_line_material) == 12
assert len(line_by_line_material) == 13

assert line_by_line_material[0].split()[0] == "c"
assert line_by_line_material[0].split()[1] == "Nb3Sn"
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_mcnp_material_lines_contain_underscore(self):
)
line_by_line_material = test_material.mcnp_material.split("\n")

assert len(line_by_line_material) == 12
assert len(line_by_line_material) == 13

assert line_by_line_material[0].split()[0] == "c"
assert line_by_line_material[0].split()[1] == "test2"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_additional_lines_multimaterial_mcnp(self):
}
)

assert test_mat3.mcnp_material.split('\n')[-1] == 'extra_mcnp_lin'
assert test_mat3.mcnp_material.split('\n')[-2] == 'extra_mcnp_lin'
assert test_mat3.serpent_material.split(
'\n')[-1] == 'extra_serpent_lin'
assert test_mat3.fispact_material.split(
Expand All @@ -59,7 +59,7 @@ def test_additional_lines_mcnp(self):
material_id=1,
additional_end_lines={'mcnp': [' mt24 lwtr.01']}
)
assert test_mat.mcnp_material.split('\n')[-1] == ' mt24 lwtr.01'
assert test_mat.mcnp_material.split('\n')[-2] == ' mt24 lwtr.01'

def test_additional_lines_shift(self):
test_mat = nmm.Material.from_library(
Expand Down Expand Up @@ -113,8 +113,8 @@ def test_additional_lines_from_json(self):
nmm.AddMaterialFromFile("extra_material_1.json")

test_mat = nmm.Material.from_library('mat_with_add_line')
assert test_mat.mcnp_material.split('\n')[-2] == 'coucou1'
assert test_mat.mcnp_material.split('\n')[-1] == 'coucou2'
assert test_mat.mcnp_material.split('\n')[-3] == 'coucou1'
assert test_mat.mcnp_material.split('\n')[-2] == 'coucou2'

def test_incorrect_additional_lines_code_name(self):

Expand Down

0 comments on commit 637dd5c

Please sign in to comment.