source: python/tests/test_aubio_cmd.py @ bb63c19

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/timestretchfix/ffmpeg5
Last change on this file since bb63c19 was fc144a5, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[tests] avoid some imports, add missing main

  • Property mode set to 100755
File size: 956 bytes
Line 
1#! /usr/bin/env python
2
3from numpy.testing import TestCase
4import aubio.cmd
5
6class aubio_cmd(TestCase):
7
8    def setUp(self):
9        self.a_parser = aubio.cmd.aubio_parser()
10
11    def test_default_creation(self):
12        try:
13            assert self.a_parser.parse_args(['-V']).show_version
14        except SystemExit:
15            url = 'https://bugs.python.org/issue9253'
16            self.skipTest('subcommand became optional in py3, see %s' % url)
17
18class aubio_cmd_utils(TestCase):
19
20    def test_samples2seconds(self):
21        self.assertEqual(aubio.cmd.samples2seconds(3200, 32000),
22                "0.100000\t")
23
24    def test_samples2milliseconds(self):
25        self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000),
26                "100.000000\t")
27
28    def test_samples2samples(self):
29        self.assertEqual(aubio.cmd.samples2samples(3200, 32000),
30                "3200\t")
31
32if __name__ == '__main__':
33    from unittest import main
34    main()
Note: See TracBrowser for help on using the repository browser.