kopia lustrzana https://github.com/F5OEO/tstools
46 wiersze
1.2 KiB
ReStructuredText
46 wiersze
1.2 KiB
ReStructuredText
Some tests for the Python binding of the TS tools
|
||
=================================================
|
||
|
||
It's difficult to find example data files that are generally available. For
|
||
the moment, I'm going to use a file I have locally, and unfortunately others
|
||
will have to manage without. This is still better than no testing...
|
||
|
||
>>> test_es_file = '/Users/tibs/sw/tstools/data/aladdin.es'
|
||
|
||
First, check we've got the basics working:
|
||
|
||
>>> from tstools import ESStream
|
||
>>> try:
|
||
... stream = ESStream(test_es_file)
|
||
... except:
|
||
... test_es_file = '/home/tibs/Videos/aladdin.es'
|
||
... stream = ESStream(test_es_file)
|
||
|
||
The filename is available as a "readonly" value:
|
||
|
||
>>> stream.filename == test_es_file
|
||
True
|
||
|
||
We should be able to iterate over its ES units:
|
||
|
||
>>> count = 0
|
||
>>> for unit in stream:
|
||
... count += 1
|
||
... print unit
|
||
... if count > 5:
|
||
... break
|
||
ES unit: start code 00
|
||
ES unit: start code 01
|
||
ES unit: start code 02
|
||
ES unit: start code 03
|
||
ES unit: start code 04
|
||
ES unit: start code 05
|
||
|
||
|
||
// Local Variables:
|
||
// tab-width: 8
|
||
// indent-tabs-mode: nil
|
||
// c-basic-offset: 2
|
||
// End:
|
||
// vim: set filetype=rst tabstop=8 shiftwidth=2 expandtab:
|