Skip to content
Snippets Groups Projects
Commit fbb585ec authored by Martin Lange's avatar Martin Lange
Browse files

fix doctests for new logging in INFO

parent 354b9896
No related branches found
No related tags found
1 merge request!240More log levels
Pipeline #134924 passed with stages
in 4 minutes and 56 seconds
......@@ -70,13 +70,14 @@ File ``src/scale.py``:
generator.outputs["Value"] >> adapter >> consumer.inputs["Input"]
comp.run(end_time=datetime(2000, 1, 2))
comp.run(end_time=datetime(2000, 1, 2)) # doctest: +ELLIPSIS
print(consumer.data["Input"][0, ...])
.. testoutput:: scale-adapter
:hide:
...
0.5 dimensionless
In :meth:`.Adapter._get_data`, we:
......@@ -238,13 +239,14 @@ In :meth:`.Adapter._get_data`, we can now do the interpolation whenever data is
generator.outputs["Value"] >> adapter >> consumer.inputs["Input"]
comp.run(end_time=datetime(2000, 1, 15))
comp.run(end_time=datetime(2000, 1, 15)) # doctest: +ELLIPSIS
print(consumer.data["Input"][0, ...])
.. testoutput:: time-adapter
:hide:
...
15.0 dimensionless
In :meth:`.Adapter._get_data`, the following happens:
......
......@@ -197,7 +197,13 @@ In the most simple case, all metadata is known in :meth:`.Component._initialize`
generator.outputs["Output2"] >> simple_conn.inputs["B"]
simple_conn.outputs["Area"] >> consumer.inputs["Input"]
comp.connect()
comp.connect() # doctest: +ELLIPSIS
.. testoutput:: simple-connect
:hide:
...
In :meth:`.Component._initialize`, we create inputs and outputs with metadata (here ``grid`` and ``units``).
Then, we create the connector with :meth:`.Component.create_connector`. No arguments required here, as there are no dependencies.
......@@ -284,7 +290,13 @@ and the initial data should be generated from it.
generator.outputs["Output2"] >> complex_conn.inputs["B"]
complex_conn.outputs["Area"] >> consumer.inputs["Input"]
comp.connect()
comp.connect() # doctest: +ELLIPSIS
.. testoutput:: complex-connect
:hide:
...
In :meth:`.Component._initialize`, we set the ``grid`` of input ``"A"`` to ``None``.
It will be filled from the connected output, and becomes available in
......
......@@ -82,8 +82,12 @@ Push-based components can use :class:`.CallbackInput` to get informed about inco
generator.outputs["Value"] >> push_comp.inputs["Input"]
comp.run(end_time=datetime(2000, 1, 15))
comp.run(end_time=datetime(2000, 1, 15)) # doctest: +ELLIPSIS
.. testoutput:: push-component
:hide:
...
In ``_initialize()``, a :class:`.CallbackInput` is added that calls ``_data_changed()`` when notified about new data.
......@@ -153,7 +157,12 @@ Push-based components can use :class:`.CallbackOutput` to intercept data pulls.
pull_comp.outputs["Output"] >> consumer.inputs["Input"]
comp.run(end_time=datetime(2000, 1, 15))
comp.run(end_time=datetime(2000, 1, 15)) # doctest: +ELLIPSIS
.. testoutput:: pull-component
:hide:
...
In ``_initialize()``, a :class:`.CallbackOutput` is added that calls ``_get_data()`` when pulled.
``_get_data()`` must return the data that would normally be pushed to the output.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment