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

Make Particle Type errors into a warning and a NotImplementedError #656

Merged
merged 10 commits into from
Feb 8, 2025
48 changes: 48 additions & 0 deletions tests/inputs/test_not_imp.imcnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
A test with a default importance (Not Implemented)
C cells
c
1 1 20
-1000 $ dollar comment
U=350 trcl=5
imp:n,p=1 $ imp:e should default to 1
2 2 8
-1005
imp:n,p=1 $ imp:e should default to 1
3 3 -1
1000 1005 -1010
imp:n=3 $ imp:e and imp:p should default to 1
99 0
1010
imp:n=9 $ imp:e should default to 1
imp:p=0
5 0
#99
imp:n=0 $ imp:e should default to 0
imp:p=0
c foo end comment

C surfaces
1000 SO 1
1005 RCC 0 1.5 -0.5 0 0 1 0.25
1010 SO 3

C data
C materials
C UO2 5 atpt enriched
m1 92235.80c 5 &
92238.80c 95
C Iron
m2 26054.80c 5.85
26056.80c 91.75
26057.80c 2.12
26058.80c 0.28
C water
m3 1001.80c 2
8016.80c 1
MT3 lwtr.23t
C execution
ksrc 0 0 0
kcode 100000 1.000 50 1050
phys:p j 1 2j 1
mode n p e

10 changes: 9 additions & 1 deletion tests/test_importance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from montepy.errors import *
from montepy.input_parser import mcnp_input, block_type
import os
import io
import pytest


Expand Down Expand Up @@ -176,6 +177,13 @@ def test_importance_merge():
imp1.merge(imp2)


def tests_redundant_importance():
def test_redundant_importance():
with pytest.raises(MalformedInputError):
montepy.read_input(os.path.join("tests", "inputs", "test_imp_redundant.imcnp"))


def test_not_imp():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to a more meaningful test name. I am going to be so confused by this in the future. Maybe: test_not_implement_on_export

prob = montepy.read_input(os.path.join("tests", "inputs", "test_not_imp.imcnp"))
prob.print_in_data_block["imp"] = True
with pytest.raises(NotImplementedError):
prob.write_problem(io.StringIO())