memote
memote copied to clipboard
Improved documentation of custom tests
Problem description
It is not obvious from the current documentation what the keys "data" and "metric" are used for and what the difference is in the current documentation.
I tried to add custom tests to the memote report, but they were displayed as "Error" without any obvious reason or error-messages.
This was discussed on GItter:
I think it would be good ta add a couple of simple examples to the documentation. Maybe also a couple of lines explaining hot to debug any issues etc.
Example
Maybe this can be used?
@annotate(title="Test that the model can produce germicidinC", format_type="number")
def test_germicidinC_production(model):
"""
Test that the model can produce germicidin C, and report how much
"""
with model:
model.reactions.DM_germicidinC_c.objective_coefficient = 1
model.reactions.BIOMASS_SCO.objective_coefficient = 0
solution = model.optimize()
ann = test_germicidinC_production.annotation
ann["data"] = solution.objective_value
ann["metric"] = int(solution.objective_value > 1e-3)
ann["message"] = "The production of germicidinC is {0}".format(solution.objective_value)
assert solution.objective_value > 1e-3, ann["message"]