source: python/tests/test_aubio_cmd.py @ 51c0b61

feature/crepe_org
Last change on this file since 51c0b61 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
RevLine 
[799a940]1#! /usr/bin/env python
2
3from numpy.testing import TestCase
[fc144a5]4import aubio.cmd
[799a940]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):
[f4fcf02]12        try:
13            assert self.a_parser.parse_args(['-V']).show_version
[5eaed62]14        except SystemExit:
[f4fcf02]15            url = 'https://bugs.python.org/issue9253'
16            self.skipTest('subcommand became optional in py3, see %s' % url)
[799a940]17
18class aubio_cmd_utils(TestCase):
19
20    def test_samples2seconds(self):
[eb6f9d3]21        self.assertEqual(aubio.cmd.samples2seconds(3200, 32000),
22                "0.100000\t")
[799a940]23
24    def test_samples2milliseconds(self):
[eb6f9d3]25        self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000),
26                "100.000000\t")
[799a940]27
28    def test_samples2samples(self):
[eb6f9d3]29        self.assertEqual(aubio.cmd.samples2samples(3200, 32000),
30                "3200\t")
[799a940]31
32if __name__ == '__main__':
[fc144a5]33    from unittest import main
[799a940]34    main()
Note: See TracBrowser for help on using the repository browser.