python/tests/test_aubio_cmd.py: fix for python << 3
[aubio.git] / python / tests / test_aubio_cmd.py
1 #! /usr/bin/env python
2
3 import aubio.cmd
4 from nose2 import main
5 from numpy.testing import TestCase
6
7 class aubio_cmd(TestCase):
8
9     def setUp(self):
10         self.a_parser = aubio.cmd.aubio_parser()
11
12     def test_default_creation(self):
13         try:
14             assert self.a_parser.parse_args(['-V']).show_version
15         except SystemExit as e:
16             url = 'https://bugs.python.org/issue9253'
17             self.skipTest('subcommand became optional in py3, see %s' % url)
18
19 class aubio_cmd_utils(TestCase):
20
21     def test_samples2seconds(self):
22         self.assertEqual(aubio.cmd.samples2seconds(3200, 32000), "0.100000\t")
23
24     def test_samples2milliseconds(self):
25         self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000), "100.000000\t")
26
27     def test_samples2samples(self):
28         self.assertEqual(aubio.cmd.samples2samples(3200, 32000), "3200\t")
29
30 if __name__ == '__main__':
31     main()