]> git.parisson.com Git - timeside.git/commitdiff
Doc: Add doctest in Intro.rst
authorThomas Fillon <thomas@parisson.com>
Tue, 13 Jan 2015 21:56:37 +0000 (22:56 +0100)
committerThomas Fillon <thomas@parisson.com>
Tue, 13 Jan 2015 21:56:37 +0000 (22:56 +0100)
doc/source/intro.rst

index cc7e3effa756d4c5a8d677cf2e7de9e3b7def045..0f09df94dae868f707771464255b537308a69e0c 100644 (file)
@@ -58,30 +58,47 @@ The streaming architecture of TimeSide relies on 2 main parts: a processing engi
 Dive in
 ========
 
-To list all available plugins::
+To list all available plugins:
 
- import timeside
- timeside.core.list_processors()
+.. doctest:: 
 
-Define some processors::
+   >>> import timeside
+   >>> timeside.core.list_processors()  # doctest: +SKIP
 
- from timeside.core import get_processor
- decoder  =  get_processor('file_decoder')('sweep.wav')
- grapher  =  get_processor('waveform_simple')
- analyzer =  get_processor('level')
- encoder  =  get_processor('vorbis_encoder')('sweep.ogg')
 
-Then run the *magic* pipeline::
 
- (decoder | grapher | analyzer | encoder).run()
 
-Render the grapher results::
+Define some processors:
 
- grapher.render(output='waveform.png')
+.. doctest::
 
-Show the analyzer results::
+    >>> from timeside.core import get_processor
+    >>> from timeside.tools.test_samples import samples
+    >>> wavfile = samples['sweep.wav']
+    >>> decoder  =  get_processor('file_decoder')(wavfile)
+    >>> grapher  =  get_processor('waveform_simple')()
+    >>> analyzer =  get_processor('level')()
+    >>> encoder  =  get_processor('vorbis_encoder')('sweep.ogg')
+
+Then run the *magic* pipeline:
+
+.. doctest:: 
+
+    >>> (decoder | grapher | analyzer | encoder).run()
+
+Render the grapher results:
+
+.. doctest:: 
+
+    >>> grapher.render(output='waveform.png')
+
+Show the analyzer results:
+
+.. doctest:: 
+
+    >>> print 'Level:', analyzer.results  # doctest: +ELLIPSIS
+    Level: {'level.max': AnalyzerResult(...)}
 
- print 'Level:', analyzer.results
 
 The encoded OGG file should also be there...