3.1.3. de_sim.testing package

3.1.3.1. Submodules

3.1.3.2. de_sim.testing.example_simulation_objects module

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2018-02-15

Copyright

2018-2020, Karr Lab

License

MIT

class de_sim.testing.example_simulation_objects.ExampleSimulationObject(name, **kwargs)[source]

Bases: de_sim.simulation_object.SimulationObject

class_priority = 1[source]
event_handlers = [(<class 'de_sim.event_message.InitMsg'>, 'handler'), (<class 'de_sim.event_message.Eg1'>, 'handler')][source]
handler(event)[source]
init_before_run(*args)[source]

Perform initialization before a simulation run

If a simulation object defines init_before_run, it will be called by the simulator just before simulation begins, after all simulation objects have been created and loaded. A simulation object that wishes to schedule initial events for itself or for other objects in the simulation should do so in init_before_run. It can also perform any other initialization in the method.

messages_sent = [<class 'de_sim.event_message.InitMsg'>, <class 'de_sim.event_message.Eg1'>][source]
metadata = <de_sim.simulation_object.SimulationObjectMetadata object>[source]
class de_sim.testing.example_simulation_objects.ImproperlyRegisteredSimulationObject(name, start_time=0, **kwargs)[source]

Bases: de_sim.simulation_object.SimulationObject

event_handlers = [(<class 'de_sim.event_message.Eg1'>, 'handler')][source]
handler(event)[source]
init_before_run(*args)[source]

Perform initialization before a simulation run

If a simulation object defines init_before_run, it will be called by the simulator just before simulation begins, after all simulation objects have been created and loaded. A simulation object that wishes to schedule initial events for itself or for other objects in the simulation should do so in init_before_run. It can also perform any other initialization in the method.

messages_sent = [<class 'de_sim.event_message.InitMsg'>][source]
metadata = <de_sim.simulation_object.SimulationObjectMetadata object>[source]

3.1.3.3. de_sim.testing.mock_simulation_object module

An interface for a mock simulation object that can evaluate unit test assertions

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2018-02-06

Copyright

2018-2020, Karr Lab

License

MIT

class de_sim.testing.mock_simulation_object.MockSimulationObject(name, test_case, **kwargs)[source]

Bases: de_sim.simulation_object.SimulationObject

An object that helps test simulation objects

abstract = True[source]
messages_sent = [][source]
metadata = <de_sim.simulation_object.SimulationObjectMetadata object>[source]

3.1.3.4. de_sim.testing.some_message_types module

3.1.3.5. de_sim.testing.utilities_for_testing module

Utilities for testing

Author

Arthur Goldberg <Arthur.Goldberg@mssm.edu>

Date

2018-05-16

Copyright

2018-2020, Karr Lab

License

MIT

de_sim.testing.utilities_for_testing.make_args(args_dict, required, options)[source]

Make command line argument list, for testing argument parsers

Parameters
  • args_dict (dict) – argument names and their values

  • required (list) – required command line arguments

  • options (list) – optional command line arguments

Returns

list of strings in command line arguments, as would appear in sys.argv[1:]

Return type

list

de_sim.testing.utilities_for_testing.unset_env_var(env_var)[source]

Temporarily unset an environment variable

Parameters

env_var (str) – environment variable to unset

3.1.3.6. Module contents