-
Notifications
You must be signed in to change notification settings - Fork 3
[WIP] Add test to validate examples in the main PALS repository #55
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||
| import argparse | ||||||
| import yaml | ||||||
|
|
||||||
| from pals import BeamLine | ||||||
|
|
||||||
|
|
||||||
| def main(): | ||||||
| # Parse command-line arguments | ||||||
| parser = argparse.ArgumentParser() | ||||||
| parser.add_argument( | ||||||
| "--path", | ||||||
| required=True, | ||||||
| help="Path to the example file", | ||||||
| ) | ||||||
| args = parser.parse_args() | ||||||
| example_file = args.path | ||||||
| # Read YAML data from file | ||||||
| with open(example_file, "r") as file: | ||||||
| data = yaml.safe_load(file) | ||||||
| # Parse and validate YAML data | ||||||
| print(f"Parsing data from {example_file}...") | ||||||
| BeamLine(**data) | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Loading the data into a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note that this, pals-python/tests/test_serialization.py Lines 25 to 26 in 6998a31
which is why I would expect it to work for the examples in the main PALS repository as well. |
||||||
|
|
||||||
|
|
||||||
| if __name__ == "__main__": | ||||||
| main() | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sparse checkout here to avoid cloning the entire repository.