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

feat: add basic memote tests #672

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/yaml-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ jobs:
## Return non-zero exit code on warnings as well as errors
# strict: # optional, default is false

- name: Basic MEMOTE tests
run: python code/test/memoteTest.py

- name: Test import with cobrapy and consistency with annotation files
run: python code/test/sanityCheck.py
run: python code/test/sanityCheck.py
18 changes: 18 additions & 0 deletions code/test/memoteTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import cobra
import memote.support.basic

if __name__ == "__main__":
try:
model = cobra.io.load_yaml_model("model/Human-GEM.yml")

# Use the MEMOTE way of testing
# https://github.com/opencobra/memote/blob/c8bd3fe75e2d955deaec824d1e93ebe60e754710/tests/test_for_support/test_for_basic.py#L908-L909
rxns, num = memote.support.basic.find_duplicate_reactions(model)
assert num == 0, "Duplicate reactions found: {}".format(rxns)

# Make sure all reactions have at least one metabolite
for r in model.reactions:
assert len(r.metabolites) > 0, "Reaction with no metabolite found: {}".format(r.id)
except AssertionError as e:
print(e)
exit(1)