From: Thomas Fillon Date: Tue, 13 Jan 2015 21:56:37 +0000 (+0100) Subject: Doc: Add doctest in Intro.rst X-Git-Tag: 0.7^2~30^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c6e1b4c500e44284824797b03bff52bdbaf5bd9f;p=timeside.git Doc: Add doctest in Intro.rst --- diff --git a/doc/source/intro.rst b/doc/source/intro.rst index cc7e3ef..0f09df9 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -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...