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

Tally segment parsing bug fix. #409

Merged
merged 8 commits into from
Jul 1, 2024

Conversation

MicahGale
Copy link
Collaborator

@MicahGale MicahGale commented Jun 13, 2024

Description

This fixes a parsing error with tally segments that have an end t.

Fixes #377

Checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@MicahGale MicahGale linked an issue Jun 13, 2024 that may be closed by this pull request
@coveralls
Copy link
Collaborator

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9492465919

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 98.228%

Totals Coverage Status
Change from base Build 9490293834: 0.005%
Covered Lines: 5764
Relevant Lines: 5868

💛 - Coveralls

@MicahGale MicahGale self-assigned this Jun 13, 2024
@MicahGale MicahGale added bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified. labels Jun 13, 2024
@MicahGale MicahGale marked this pull request as ready for review June 13, 2024 02:04
@coveralls
Copy link
Collaborator

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9492487926

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 98.228%

Totals Coverage Status
Change from base Build 9490293834: 0.005%
Covered Lines: 5764
Relevant Lines: 5868

💛 - Coveralls

@MicahGale MicahGale requested a review from tjlaboss June 13, 2024 02:04
@tjlaboss
Copy link
Collaborator

tjlaboss commented Jun 17, 2024

Testing with C:

>>> import montepy
>>> dblock = montepy.input_parser.mcnp_input.Input(["fs567 -1 -2 t c"], montepy.input_parser.block_type.BlockType.DATA)
>>> montepy.data_inputs.data_parser.parse_data(dblock)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MontePy/montepy/data_inputs/data_parser.py", line 53, in parse_data
    return data_class(input)
  File "MontePy/montepy/data_inputs/data_input.py", line 54, in __init__
    super().__init__(input, self._parser)
  File "MontePy/montepy/mcnp_object.py", line 57, in __init__
    raise ParsingError(
montepy.errors.ParsingError:     , line 0

    >    0| fs567 -1 -2 t c
          |               ^ not expected here.
There was an error parsing "c".
sly: Syntax error at line 1, token=TEXT

montepy/data_inputs/tally_segment.py Outdated Show resolved Hide resolved
tests/test_tally.py Outdated Show resolved Hide resolved
@MicahGale
Copy link
Collaborator Author

Testing with C:

>>> import montepy
>>> dblock = montepy.input_parser.mcnp_input.Input(["fs567 -1 -2 t c"], montepy.input_parser.block_type.BlockType.DATA)
>>> montepy.data_inputs.data_parser.parse_data(dblock)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MontePy/montepy/data_inputs/data_parser.py", line 53, in parse_data
    return data_class(input)
  File "MontePy/montepy/data_inputs/data_input.py", line 54, in __init__
    super().__init__(input, self._parser)
  File "MontePy/montepy/mcnp_object.py", line 57, in __init__
    raise ParsingError(
montepy.errors.ParsingError:     , line 0

    >    0| fs567 -1 -2 t c
          |               ^ not expected here.
There was an error parsing "c".
sly: Syntax error at line 1, token=TEXT

This is what I get for trying to close a bug without reading or understanding the FS documentation. Of course they made c a keyword.

@MicahGale MicahGale marked this pull request as draft June 17, 2024 15:45
@coveralls
Copy link
Collaborator

coveralls commented Jun 17, 2024

Pull Request Test Coverage Report for Build 9550870299

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 98.245%

Totals Coverage Status
Change from base Build 9550865708: 0.02%
Covered Lines: 5765
Relevant Lines: 5868

💛 - Coveralls

@MicahGale MicahGale marked this pull request as ready for review July 1, 2024 18:28
@MicahGale MicahGale requested a review from tjlaboss July 1, 2024 18:28
Copy link
Collaborator

@tjlaboss tjlaboss left a comment

Choose a reason for hiding this comment

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

New test covers the 'c for cumulative' syntax, and MontePy now correctly parses it.

@MicahGale MicahGale merged commit ab305aa into develop Jul 1, 2024
14 checks passed
@MicahGale MicahGale deleted the 377-parsing-error-with-tally-segment branch July 1, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs A deviation from expected behavior that does not reach the level of being reportable as an "Error". parsers are hard Examples of where MCNP syntax is complicated and should be simplified.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parsing Error with Tally Segment
3 participants