shithub: aubio

Download patch

ref: f0ce8aa38a9a315283eab3f2244fb0cbfc4bca08
parent: 60c8a734e7e7706bacd9e06501d2ee7d3973cea7
author: Paul Brossier <piem@piem.org>
date: Mon Oct 29 11:26:24 EDT 2018

[py] [slicing] add test for missing end of last region

--- a/python/tests/test_slicing.py
+++ b/python/tests/test_slicing.py
@@ -97,6 +97,19 @@
         assert_equal(written_samples, expected_samples,
             "number of samples written different from number of original samples")
 
+    def test_slice_start_and_ends_with_missing_end(self):
+        regions_start = [i*1000 for i in range(n_slices)]
+        regions_ends = [r-1 for r in regions_start[1:]]
+        slice_source_at_stamps(self.source_file, regions_start, regions_ends,
+                output_dir = self.output_dir)
+        written_samples = count_samples_in_directory(self.output_dir)
+        original_samples = count_samples_in_file(self.source_file)
+        total_files = count_files_in_directory(self.output_dir)
+        assert_equal(n_slices, total_files,
+            "number of slices created different from expected")
+        assert_equal(written_samples, original_samples,
+            "number of samples written different from number of original samples")
+
     def tearDown(self):
         shutil.rmtree(self.output_dir)