Skip to content

Commit

Permalink
run test_mock_simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
artgoldberg committed Aug 16, 2019
1 parent 71c82b6 commit ffa5815
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 45 deletions.
1 change: 0 additions & 1 deletion tests/config/test_core.py
Expand Up @@ -26,5 +26,4 @@ def test_get_config(self):
self.assertEqual(config['de_sim']['copy_event_bodies'], True)

def test_debug_logs(self):
print(debug_logs.logs.get_log('wc.debug.file'))
self.assertTrue(isinstance(debug_logs.logs.get_log('wc.debug.file'), logging2.loggers.Logger))
42 changes: 0 additions & 42 deletions tests/test_checkpoint.py
Expand Up @@ -77,7 +77,6 @@ def test_constructor_creates_checkpoint_dir(self):
CheckpointLogger(checkpoint_dir, checkpoint_step, init_time)
self.assertTrue(os.path.isdir(checkpoint_dir))

"""
def test_mock_simulator(self):
checkpoint_dir = self.checkpoint_dir
checkpoint_step = 2
Expand Down Expand Up @@ -146,46 +145,6 @@ def test_mock_simulator(self):
wc_utils.util.types.assert_value_not_equal(chkpt.random_state, final_random_state, check_iterable_ordering=True)


def build_mock_model():
''' Create test model:
L --> R
* 1 compartment
* 2 species
* 1 reaction
* 1 submodel
'''
model = wc_lang.Model()
submodel = model.submodels.create(id='submodel', framework=onto['WC:stochastic_simulation_algorithm'])
init_volume=wc_lang.InitVolume(mean=1.)
compartment_c = model.compartments.create(id='c', init_volume=init_volume)
compartment_e = model.compartments.create(id='e', init_volume=init_volume)
structure = wc_lang.ChemicalStructure(molecular_weight=10.)
species_type_L = model.species_types.create(id='L', structure=structure)
species_type_R = model.species_types.create(id='R', structure=structure)
species_L = wc_lang.Species(id='L[c]', species_type=species_type_L, compartment=compartment_c)
species_R = wc_lang.Species(id='R[c]', species_type=species_type_R, compartment=compartment_c)
species = [species_L, species_R]
wc_lang.Concentration(species=species_L, value=1., units=unit_registry.parse_units('molecule'))
wc_lang.Concentration(species=species_R, value=0., units=unit_registry.parse_units('molecule'))
reaction = submodel.reactions.create(id='reaction')
reaction.rate_laws.create(direction=wc_lang.RateLawDirection.forward,
equation=wc_lang.RateLawEquation(expression='0.0'))
reaction.participants.create(species=species_L, coefficient=-1)
reaction.participants.create(species=species_R, coefficient=1)
model.parameters.create(id='mean_doubling_time', value=30. * 60, units=unit_registry.parse_units('s')),
return model
def mock_simulate(metadata, init_time=0, init_state=None, init_random_state=None, checkpoint_dir=None,
checkpoint_step=None):
# initialize
Expand Down Expand Up @@ -216,4 +175,3 @@ def mock_simulate(metadata, init_time=0, init_state=None, init_random_state=None
logger.checkpoint_periodically(time, state, random_state)

return (time, state, random_state.get_state())
"""
4 changes: 2 additions & 2 deletions tests/test_simulation_checkpoint_object.py
Expand Up @@ -14,8 +14,8 @@
from wc_utils.util.rand import RandomStateManager
from de_sim.simulation_engine import SimulationEngine
from de_sim.simulation_checkpoint_object import (AbstractCheckpointSimulationObject,
CheckpointSimulationObject,
AccessStateObjectInterface)
CheckpointSimulationObject,
AccessStateObjectInterface)
from de_sim.simulation_message import SimulationMessage
from de_sim.simulation_object import ApplicationSimulationObject
from de_sim.errors import SimulatorError
Expand Down

0 comments on commit ffa5815

Please sign in to comment.