Skip to content

Commit 244d4ee

Browse files
committed
inp: fixed SI parameter
1 parent ca5a2f5 commit 244d4ee

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

src/pymcnp/inp/Si_0.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Si_0(_card.Card):
1818
'information': types.Tuple(types.Distribution),
1919
}
2020

21-
_REGEX = re.compile(rf'\Asi(\d+)( {types.String._REGEX.pattern[2:-2]})?((?: {types.Distribution._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
21+
_REGEX = re.compile(rf'\Asi(\d+)( [hlas])?((?: {types.Distribution._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
2222

2323
def __init__(self, suffix: str | int | types.Integer, information: list[str] | list[types.Distribution], option: str | types.String = None):
2424
"""

src/pymcnp/inp/Si_1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Si_1(_card.Card):
1818
'information': types.Tuple(types.Real),
1919
}
2020

21-
_REGEX = re.compile(rf'\Asi(\d+)( {types.String._REGEX.pattern[2:-2]})?((?: {types.Real._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
21+
_REGEX = re.compile(rf'\Asi(\d+)( [hlas])?((?: {types.Real._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
2222

2323
def __init__(self, suffix: str | int | types.Integer, information: list[str] | list[float] | list[types.Real], option: str | types.String = None):
2424
"""

src/pymcnp/inp/Si_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Si_2(_card.Card):
1818
'information': types.Tuple(types.Designator),
1919
}
2020

21-
_REGEX = re.compile(rf'\Asi(\d+)( {types.String._REGEX.pattern[2:-2]})?((?: {types.Designator._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
21+
_REGEX = re.compile(rf'\Asi(\d+)( [hlas])?((?: {types.Designator._REGEX.pattern[2:-2]})+?)\Z', re.IGNORECASE)
2222

2323
def __init__(self, suffix: str | int | types.Integer, information: list[str] | list[types.Designator], option: str | types.String = None):
2424
"""

tests/consts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ class inp:
9797
BFLD = 'bfld1 const field=3.1'
9898
BFLCL = 'bflcl 1 1 1'
9999
SDEF = 'sdef cel=1'
100-
SI_0 = 'si1 hello d1 d1 d1'
101-
SI_1 = 'si1 hello 3.1 3.1 3.1'
102-
SI_2 = 'si1 hello @ @ @'
100+
SI_0 = 'si1 h d1 d1 d1'
101+
SI_1 = 'si1 h 3.1 3.1 3.1'
102+
SI_2 = 'si1 h @ @ @'
103103
SP_0 = 'sp1 d 3.1'
104104
SP_1 = 'sp -2 3.1 3.1'
105105
SB_0 = 'sb1 d 3.1 3.1 3.1'

tests/test_pymcnp/test_inp/test_Si_0.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class Test_Si_0:
77
class Test_Init(classes.Test_Init):
88
element = pymcnp.inp.Si_0
99
EXAMPLES_VALID = [
10-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': [consts.string.types.DISTRIBUTION]},
11-
{'suffix': 1, 'option': consts.string.types.STRING, 'information': [consts.string.types.DISTRIBUTION]},
12-
{'suffix': consts.ast.types.INTEGER, 'option': consts.ast.types.STRING, 'information': [consts.ast.types.DISTRIBUTION]},
10+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': [consts.string.types.DISTRIBUTION]},
11+
{'suffix': 1, 'option': 'h', 'information': [consts.string.types.DISTRIBUTION]},
12+
{'suffix': consts.ast.types.INTEGER, 'option': pymcnp.types.String('h'), 'information': [consts.ast.types.DISTRIBUTION]},
1313
{'suffix': consts.string.types.INTEGER, 'option': None, 'information': [consts.string.types.DISTRIBUTION]},
1414
]
1515
EXAMPLES_INVALID = [
16-
{'suffix': None, 'option': consts.string.types.STRING, 'information': [consts.string.types.DISTRIBUTION]},
17-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': None},
16+
{'suffix': None, 'option': 'h', 'information': [consts.string.types.DISTRIBUTION]},
17+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': None},
1818
]
1919

2020
class Test_Mcnp(classes.Test_Mcnp):

tests/test_pymcnp/test_inp/test_Si_1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class Test_Si_1:
77
class Test_Init(classes.Test_Init):
88
element = pymcnp.inp.Si_1
99
EXAMPLES_VALID = [
10-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': [consts.string.types.REAL]},
11-
{'suffix': 1, 'option': consts.string.types.STRING, 'information': [3.1]},
12-
{'suffix': consts.ast.types.INTEGER, 'option': consts.ast.types.STRING, 'information': [consts.ast.types.REAL]},
10+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': [consts.string.types.REAL]},
11+
{'suffix': 1, 'option': 'h', 'information': [3.1]},
12+
{'suffix': consts.ast.types.INTEGER, 'option': pymcnp.types.String('h'), 'information': [consts.ast.types.REAL]},
1313
{'suffix': consts.string.types.INTEGER, 'option': None, 'information': [consts.string.types.REAL]},
1414
]
1515
EXAMPLES_INVALID = [
16-
{'suffix': None, 'option': consts.string.types.STRING, 'information': [consts.string.types.REAL]},
17-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': None},
16+
{'suffix': None, 'option': 'h', 'information': [consts.string.types.REAL]},
17+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': None},
1818
]
1919

2020
class Test_Mcnp(classes.Test_Mcnp):

tests/test_pymcnp/test_inp/test_Si_2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class Test_Si_2:
77
class Test_Init(classes.Test_Init):
88
element = pymcnp.inp.Si_2
99
EXAMPLES_VALID = [
10-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': [consts.string.types.DESIGNATOR]},
11-
{'suffix': 1, 'option': consts.string.types.STRING, 'information': [consts.string.types.DESIGNATOR]},
12-
{'suffix': consts.ast.types.INTEGER, 'option': consts.ast.types.STRING, 'information': [consts.ast.types.DESIGNATOR]},
10+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': [consts.string.types.DESIGNATOR]},
11+
{'suffix': 1, 'option': 'h', 'information': [consts.string.types.DESIGNATOR]},
12+
{'suffix': consts.ast.types.INTEGER, 'option': 'h', 'information': [consts.ast.types.DESIGNATOR]},
1313
{'suffix': consts.string.types.INTEGER, 'option': None, 'information': [consts.string.types.DESIGNATOR]},
1414
]
1515
EXAMPLES_INVALID = [
16-
{'suffix': None, 'option': consts.string.types.STRING, 'information': [consts.string.types.DESIGNATOR]},
17-
{'suffix': consts.string.types.INTEGER, 'option': consts.string.types.STRING, 'information': None},
16+
{'suffix': None, 'option': 'h', 'information': [consts.string.types.DESIGNATOR]},
17+
{'suffix': consts.string.types.INTEGER, 'option': 'h', 'information': None},
1818
]
1919

2020
class Test_Mcnp(classes.Test_Mcnp):

0 commit comments

Comments
 (0)