-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java: Test generator improvements #12195
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
Java: Test generator improvements #12195
Conversation
- Accept yml files as input - Output the correct type for constructors
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.
Thanks for adding this! It'll be super useful for the rest of the modeling work we're doing.
I added some minor comments, but otherwise this LGTM.
specs = [] | ||
for f in os.listdir(dirname): | ||
if f.endswith('.yml'): | ||
specs += readYml(f"{dirname}/{f}") | ||
return specs |
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.
May I suggest an implementation a bit more pythonic?
specs = [] | |
for f in os.listdir(dirname): | |
if f.endswith('.yml'): | |
specs += readYml(f"{dirname}/{f}") | |
return specs | |
return [readYml(f"{dirname}/{f}") for f in os.listdir(dirname) if f.endswith('.yml')] |
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.
That isn't equivalent is it? As that would result in a list of lists, rather than a single list of rows
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.
D'oh, true, sorry. That would then probably need to be something like:
specs = [] | |
for f in os.listdir(dirname): | |
if f.endswith('.yml'): | |
specs += readYml(f"{dirname}/{f}") | |
return specs | |
return [row for row in readYml(f"{dirname}/{f}") for f in os.listdir(dirname) if f.endswith('.yml')] |
But the readability starts getting bad at that point, so feel free to leave it as it is.
This PR allows the test generator to accept a yml file or a diretory of yml files containing MaD specifications as input.
Also, the generated "return type" of a constuctor is now considered to be the constructed type.