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

test: added an edge case in ReactionSystem #1174

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

sivasathyaseeelan
Copy link
Contributor

I have added an edge cases to test ReactionSystem which were not tested before.

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

The test is well written, but I don't see how this tests something relevant to the package? I.e. if I understand it correct, what we want to test is that if the user updates the Catalyst.forbidden_symbols_error list with a new forbidden variable, then these cannot be used?

I am mostly surprised that the user can update Catalyst.forbidden_symbols_error, which really isn;t something anyone should do.

Is this looking at a specific line in the code which we do not have coverage on? In that case we could have al ook at it to see if there is a better way to cover it.

Even if we do not end up using this, still thanks for your effort with the PR!


# Define parameters and species including forbidden symbols
@parameters p1 forbidden1
@species S1 forbidden2(t)
Copy link
Member

Choose a reason for hiding this comment

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

Should be S(t), species should always depend on an independent variable.

@sivasathyaseeelan
Copy link
Contributor Author

The test is well written, but I don't see how this tests something relevant to the package? I.e. if I understand it correct, what we want to test is that if the user updates the Catalyst.forbidden_symbols_error list with a new forbidden variable, then these cannot be used?

I am mostly surprised that the user can update Catalyst.forbidden_symbols_error, which really isn;t something anyone should do.

Is this looking at a specific line in the code which we do not have coverage on? In that case we could have al ook at it to see if there is a better way to cover it.

Even if we do not end up using this, still thanks for your effort with the PR!

I thought of creating some random forbidden symbols. I will remove it and replace it with any exiting forbidden symbol

Also this covers the below condition
Screenshot from 2025-01-15 01-54-47

Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

sounds good

@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

Also, you might want to use test_throws to check whether a line of code generates an error.

@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

https://docs.julialang.org/en/v1/stdlib/Test/#Test.@test_throws

Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

Looking closer, this seems like a repeat of

    # System using a forbidden symbol.
    @test_throws Exception rs = ReactionSystem([Reaction(Γ, [X1], [])], t; named = :rs)

from the test block just above yours.

However, there is an error in that test that means that that specific error is not hit (named should be name). if you want you can fix that bug error though :)

@sivasathyaseeelan
Copy link
Contributor Author

sivasathyaseeelan commented Jan 14, 2025

Looking closer, this seems like a repeat of

    # System using a forbidden symbol.
    @test_throws Exception rs = ReactionSystem([Reaction(Γ, [X1], [])], t; named = :rs)

from the test block just above yours.

However, there is an error in that test that means that that specific error is not hit (named should be name). if you want you can fix that bug error though :)

I will fix the bug in previous test and remove the new test set!

Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
@TorkelE
Copy link
Member

TorkelE commented Jan 14, 2025

Thanks, will merge once everything passes.

@TorkelE TorkelE merged commit 37e3e5b into SciML:master Jan 14, 2025
13 checks passed
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