# test.generic.test_io module — Python(P)DEVS-BBL documentation

# test.generic.test_io module

Tests the Input/Output building blocks to prove validity w.r.t. these tests.

Note

The `pypdevsbbl.generic.io.Sound` block cannot be tested in a unit test, but it has been checked that the sounds will be played. To test this yourself, execute the `pypdevsbbl.generic.io` module.

See also

`pypdevsbbl.generic.io`

class `test.generic.test_io.``StubLogger`

  Bases: `object`

  Helper class to cheat the usage of an actual logger.

  `debug`(msg)
  `info`(msg)
  `notice`(msg)
  `warn`(msg)
  `error`(msg)
  `critical`(msg)
  `alert`(msg)
  `emerg`(msg)

class `test.generic.test_io.``IOModel`(table, block, inp)

  Bases: `pypdevs.DEVS.CoupledDEVS`

  Simple model constructor for the tests.

  Parameters:

  - table (list) – A list with all events that should happen.
  - block – The block to connect to the `pypdevsbbl.generic.generators.TableGenerator`.
  - inp – The input port to connect the generator on.

`test.generic.test_io.``simulate`(table, block, inp, tt=None)

  Simulates the model.

  Parameters:

  - table (list) – A list with all events that should happen.
  - block – The block to connect to the `pypdevsbbl.generic.generators.TableGenerator`.
  - inp – The input port to connect the generator on.
  - tt (numeric) – The termination time or `None` if no termination time needs to be set. Defaults to `None`.

class `test.generic.test_io.``TestIO`(methodName='runTest')

  Bases: `unittest.case.TestCase`

  `setUp`()
  `test_logger`()

    Tests the `pypdevsbbl.generic.io.Logger` and all its subclasses.

  `test_file_writer`()

    Tests the `pypdevsbbl.generic.io.FileWriter`.

  `test_file_reader`()

    Tests the `pypdevsbbl.generic.io.FileReader`.

  `test_listener`()

    Tests the `pypdevsbbl.generic.io.Listener`.