def compare_models(model_1, model_2):
assert len(model_1.reactions) == len(model_2.reactions)<EOL>assert len(model_1.metabolites) == len(model_2.metabolites)<EOL>assert len(model_1.genes) == len(model_2.genes)<EOL>assert model_1.objective.direction == model_2.objective.direction<EOL>for attr in ("<STR_LIT:id>", "<STR_LIT:name>", "<STR_LIT>", "<STR_LIT>",<EOL>"<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>assert getattr(model_1.reactions[<NUM_LIT:0>], attr) == getattr(<EOL>model_2.reactions[<NUM_LIT:0>], attr)<EOL>assert getattr(model_1.reactions[<NUM_LIT:5>], attr) == getattr(<EOL>model_2.reactions[<NUM_LIT:5>], attr)<EOL>assert getattr(model_1.reactions[-<NUM_LIT:1>], attr) == getattr(<EOL>model_2.reactions[-<NUM_LIT:1>], attr)<EOL><DEDENT>for attr in ("<STR_LIT:id>", "<STR_LIT:name>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>assert getattr(model_1.metabolites[<NUM_LIT:0>], attr) == getattr(<EOL>model_2.metabolites[<NUM_LIT:0>], attr)<EOL>assert getattr(model_1.metabolites[<NUM_LIT:5>], attr) == getattr(<EOL>model_2.metabolites[<NUM_LIT:5>], attr)<EOL>assert getattr(model_1.metabolites[-<NUM_LIT:1>], attr) == getattr(<EOL>model_2.metabolites[-<NUM_LIT:1>], attr)<EOL>assert len(model_1.reactions[<NUM_LIT:0>].metabolites) == len(<EOL>model_2.reactions[<NUM_LIT:0>].metabolites)<EOL><DEDENT>assert len(model_1.reactions[<NUM_LIT:8>].metabolites) == len(<EOL>model_2.reactions[<NUM_LIT:8>].metabolites)<EOL>assert len(model_1.reactions[-<NUM_LIT:1>].metabolites) == len(<EOL>model_2.reactions[-<NUM_LIT:1>].metabolites)<EOL>assert len(model_1.genes) == len(model_2.genes)<EOL>solution_1 = model_1.optimize()<EOL>solution_2 = model_2.optimize()<EOL>assert abs(solution_1.objective_value -<EOL>solution_2.objective_value) == pytest.approx(<NUM_LIT:0.0>)<EOL>assert model_1.metabolites[<NUM_LIT:0>]._model is model_1<EOL>assert model_2.metabolites[<NUM_LIT:0>]._model is model_2<EOL>assert model_1.reactions[<NUM_LIT:0>]._model is model_1<EOL>assert model_2.reactions[<NUM_LIT:0>]._model is model_2<EOL>assert model_1.genes[<NUM_LIT:0>]._model is model_1<EOL>assert model_2.genes[<NUM_LIT:0>]._model is model_2<EOL>
Compare two models (only for testing purposes).