-
Notifications
You must be signed in to change notification settings - Fork 12
added mass reading and test #57
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
Merged
thomasms
merged 7 commits into
fispact:master
from
shimwell:adding-input-reading-for-mass
Apr 21, 2025
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4d91d22
added mass reading and test
shimwell b29640f
min diff
shimwell 35a011e
reviewer comments on input file mass
shimwell d2ed141
removed unused parts
shimwell d43ec80
added test input file
shimwell 215a95c
Merge branch 'fispact:master' into adding-input-reading-for-mass
shimwell eaa3e64
added missing self
shimwell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import pypact as pp | ||
|
|
||
|
|
||
| def test_reading_in_mass(): | ||
shimwell marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ff = pp.InputData() | ||
| pp.from_file(ff, 'examples/files/test.i') | ||
shimwell marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Assert that the inventory is set to mass mode | ||
| assert ff._inventoryismass is True, "Inventory should be set to mass mode" | ||
| assert ff._inventoryisfuel is False, "Inventory should not be set to fuel mode" | ||
|
|
||
| # Assert the total mass | ||
| assert ff._inventorymass.totalMass == 1.0, "Total mass should be 1.0" | ||
|
|
||
| # Assert the number of elements | ||
| assert len(ff._inventorymass.entries) == 3, "There should be 3 elements in the inventory" | ||
|
|
||
| # Assert the elements and their percentages | ||
| expected_elements = [ | ||
| ("Ti", 80.0), | ||
| ("Fe", 14.8), | ||
| ("Cr", 5.2) | ||
| ] | ||
| for i, (element, percentage) in enumerate(expected_elements): | ||
| assert ff._inventorymass.entries[i][0] == element, f"Element {i} should be {element}" | ||
| assert ff._inventorymass.entries[i][1] == percentage, f"Percentage of {element} should be {percentage}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.