Skip to content

Commit

Permalink
set strict=False in Reader().run to avoid "The model cannot be loaded…
Browse files Browse the repository at this point in the history
… because ... the attributes must be defined in this order" errors
  • Loading branch information
artgoldberg committed Apr 26, 2018
1 parent 936f512 commit 5e5352f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/multialgorithm/submodels/test_ssa.py
Expand Up @@ -28,7 +28,7 @@ def setUp(self):
SimulationEngine.reset()
self.MODEL_FILENAME = os.path.join(os.path.dirname(__file__), 'fixtures', 'test_model.xlsx')
# make a model
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)
ExecutableModel.set_up_simulation(self.model)

@unittest.skip("skip")
Expand Down
4 changes: 2 additions & 2 deletions tests/multialgorithm/submodels/test_submodels.py
Expand Up @@ -52,7 +52,7 @@ def setUp(self):

self.MODEL_FILENAME = os.path.join(os.path.dirname(__file__), 'fixtures',
'test_submodel_no_shared_species.xlsx')
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)
prepare_model(self.model)
self.dynamic_submodels = {}
self.misconfigured_dynamic_submodels = {}
Expand Down Expand Up @@ -150,7 +150,7 @@ def setUp(self):
warnings.simplefilter("ignore")
self.MODEL_FILENAME = os.path.join(os.path.dirname(__file__), 'fixtures',
'test_submodel_no_shared_species.xlsx')
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)
prepare_model(self.model)

def make_sim_w_skeleton_submodel(self, lang_submodel, behavior):
Expand Down
2 changes: 1 addition & 1 deletion tests/multialgorithm/test_dynamic_components.py
Expand Up @@ -68,7 +68,7 @@ def setUp(self):

def read_model(self, model_filename):
# read and initialize a model
self.model = Reader().run(model_filename)
self.model = Reader().run(model_filename, strict=False)
multialgorithm_simulation = MultialgorithmSimulation(self.model, None)
dynamic_compartments = list(multialgorithm_simulation.dynamic_compartments.values())

Expand Down
2 changes: 1 addition & 1 deletion tests/multialgorithm/test_model_utilities.py
Expand Up @@ -24,7 +24,7 @@ def get_submodel(self, id_val):
def setUp(self):
# read a model
Submodel.objects.reset()
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)

def test_find_private_species(self):
# since set() operations are being used, this test does not ensure that the methods being
Expand Down
5 changes: 2 additions & 3 deletions tests/multialgorithm/test_multialgorithm_simulation.py
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
for base_model in [Submodel, Species, SpeciesType]:
base_model.objects.reset()
# read and initialize a model
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)
args = Namespace(FBA_time_step=1)
self.multialgorithm_simulation = MultialgorithmSimulation(self.model, args)

Expand Down Expand Up @@ -125,7 +125,6 @@ def get_model_type_params(model_type):

def make_test_model(self, model_type):
""" Create a test model
"""
num_species, num_reactions, reversible, rate_law_type = self.get_model_type_params(model_type)
if 2<num_species or 1<num_reactions:
Expand Down Expand Up @@ -256,7 +255,7 @@ def test_make_test_model(self):
# print('\n', model_type, ':')
self.make_test_model(model_type)
# TODO(Arthur): NEXT, unittest one of the models made
# TODO(Arthur): NEXT, write the models to spreadsheets
# TODO(Arthur): NEXT, write the models to spreadsheets and review them
# TODO(Arthur): NEXT, run SSA with '1 species, 1 reaction'

def setUp(self):
Expand Down
Expand Up @@ -30,7 +30,7 @@ def setUp(self):
SimulationEngine.reset()
self.MODEL_FILENAME = os.path.join(os.path.dirname(__file__), 'fixtures', 'test_model.xlsx')
# make a model
self.model = Reader().run(self.MODEL_FILENAME)
self.model = Reader().run(self.MODEL_FILENAME, strict=False)
ExecutableModel.set_up_simulation(self.model)

@unittest.skip("skip")
Expand Down
2 changes: 1 addition & 1 deletion tests/multialgorithm/test_species_populations.py
Expand Up @@ -64,7 +64,7 @@ def set_up_simulation(self, model_file):
'''
# make a model
self.model = Reader().run(model_file)
self.model = Reader().run(model_file, strict=False)
# make SpeciesPopSimObjects
self.private_species = ModelUtilities.find_private_species(self.model, return_ids=True)
Expand Down

0 comments on commit 5e5352f

Please sign in to comment.