python/tests/test_aubio_*.py: add basic tests
authorPaul Brossier <piem@piem.org>
Sat, 16 Sep 2017 15:46:54 +0000 (17:46 +0200)
committerPaul Brossier <piem@piem.org>
Sat, 16 Sep 2017 15:46:54 +0000 (17:46 +0200)
python/tests/test_aubio_cmd.py [new file with mode: 0755]
python/tests/test_aubio_cut.py [new file with mode: 0755]

diff --git a/python/tests/test_aubio_cmd.py b/python/tests/test_aubio_cmd.py
new file mode 100755 (executable)
index 0000000..79675cb
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/env python
+
+import aubio.cmd
+from nose2 import main
+from numpy.testing import TestCase
+
+class aubio_cmd(TestCase):
+
+    def setUp(self):
+        self.a_parser = aubio.cmd.aubio_parser()
+
+    def test_default_creation(self):
+        assert self.a_parser.parse_args(['-V']).show_version
+
+class aubio_cmd_utils(TestCase):
+
+    def test_samples2seconds(self):
+        self.assertEqual(aubio.cmd.samples2seconds(3200, 32000), "0.100000\t")
+
+    def test_samples2milliseconds(self):
+        self.assertEqual(aubio.cmd.samples2milliseconds(3200, 32000), "100.000000\t")
+
+    def test_samples2samples(self):
+        self.assertEqual(aubio.cmd.samples2samples(3200, 32000), "3200\t")
+
+if __name__ == '__main__':
+    main()
diff --git a/python/tests/test_aubio_cut.py b/python/tests/test_aubio_cut.py
new file mode 100755 (executable)
index 0000000..cbbfe05
--- /dev/null
@@ -0,0 +1,16 @@
+#! /usr/bin/env python
+
+import aubio.cut
+from nose2 import main
+from numpy.testing import TestCase
+
+class aubio_cut(TestCase):
+
+    def setUp(self):
+        self.a_parser = aubio.cut.aubio_cut_parser()
+
+    def test_default_creation(self):
+        assert self.a_parser.parse_args(['-v']).verbose
+
+if __name__ == '__main__':
+    main()