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

Add tests #37

Closed
wants to merge 9 commits into from
Closed

Add tests #37

wants to merge 9 commits into from

Conversation

jentjr
Copy link
Contributor

@jentjr jentjr commented Nov 23, 2019

Working on adding some tests for #33.

@mbakker7
Copy link
Owner

My suggestion for testing storeinput is to add an element, use writemodel to write the model and then read it back in. The resulting model should be the same.

@jentjr
Copy link
Contributor Author

jentjr commented Nov 24, 2019

Am I correct that the writemodel method needs to be added to class Model, and the method should initialize all the elements, then use inspect to store the elements in a nested dictionary? Right now it looks like the inputvalues from storeinput are for the individual elements and are not being added to the model.

from timml import *

ml = ModelMaq()
uf = Uflow(ml, slope=0.001, angle=150)

ml.inputvalues

{'self': <timml.model.ModelMaq at 0x7f1cc7e457f0>,
 'kaq': 1,
 'z': [1, 0],
 'c': [],
 'npor': 0.3,
 'topboundary': 'conf',
 'hstar': None,
 'f2py': False}

I would have expected the Uflow element to also be listed. I'm not quite sure how it would work, but I can keep trying.

Should methods be added to write and read a model from a file?

@mbakker7
Copy link
Owner

You are right, I never copied the write and writemodel methods from TTim. Just added those with 0b4abeb

Needs further testing, but the following basic example works:

ml = ModelMaq()
rf = Constant(ml, 20, 20, 33)
ml.ml.writemodel('testmodel.py')

After that, the file testmodel.py can be run to get the same model back.

@jentjr
Copy link
Contributor Author

jentjr commented Nov 24, 2019

Okay, thanks. I'll take a look at it.

@mbakker7
Copy link
Owner

@jentjr on a related topic, can you remove the timml readthedocs page that you created? We will then add the new readthedocs page for timml similar to the new ttim readthedocs page. But now the name is already taken by the readthedocs page you created.

@jentjr
Copy link
Contributor Author

jentjr commented Oct 24, 2023

I removed the timml readthedocs page I created.

@mbakker7
Copy link
Owner

Thanks, @jentjr. The new template for readthedocs is now online. We will start populating it with content in the next few months.

@mbakker7
Copy link
Owner

mbakker7 commented Dec 6, 2023

This PR is a bit stale by now. If you still have tests that are worthwhile for TimML, then I suggest you start a new PR and I will close this one. Adding more and better tests is definitely something we need.

@jentjr jentjr closed this Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants