Changeset 633400d for python/tests/test_slicing.py
- Timestamp:
- Dec 5, 2018, 10:34:39 PM (6 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 283a619a
- Parents:
- 5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tests/test_slicing.py
r5b46bc3 r633400d 4 4 from numpy.testing import TestCase, assert_equal 5 5 from aubio import slice_source_at_stamps 6 from utils import count_files_in_directory, get_default_test_sound7 from utils import count_samples_in_directory, count_samples_in_file6 from .utils import count_files_in_directory, get_default_test_sound 7 from .utils import count_samples_in_directory, count_samples_in_file 8 8 9 9 import tempfile … … 24 24 def test_slice_start_only_no_zero(self): 25 25 regions_start = [i*1000 for i in range(1, n_slices)] 26 slice_source_at_stamps(self.source_file, regions_start, output_dir = self.output_dir) 26 slice_source_at_stamps(self.source_file, regions_start, 27 output_dir = self.output_dir, create_first=True) 27 28 28 29 def test_slice_start_beyond_end(self): 29 30 regions_start = [i*1000 for i in range(1, n_slices)] 30 31 regions_start += [count_samples_in_file(self.source_file) + 1000] 31 slice_source_at_stamps(self.source_file, regions_start, output_dir = self.output_dir) 32 slice_source_at_stamps(self.source_file, regions_start, 33 output_dir = self.output_dir, create_first=True) 32 34 33 35 def test_slice_start_every_blocksize(self): 34 36 hopsize = 200 35 regions_start = [i*hopsize for i in range( 1, n_slices)]37 regions_start = [i*hopsize for i in range(0, n_slices)] 36 38 slice_source_at_stamps(self.source_file, regions_start, output_dir = self.output_dir, 37 39 hopsize = 200) 40 41 def test_slice_start_every_half_blocksize(self): 42 hopsize = 200 43 regions_start = [i*hopsize//2 for i in range(0, n_slices)] 44 slice_source_at_stamps(self.source_file, regions_start, 45 output_dir = self.output_dir, hopsize = 200) 38 46 39 47 def tearDown(self): … … 92 100 "number of samples written different from number of original samples") 93 101 102 def test_slice_start_and_ends_with_missing_end(self): 103 regions_start = [i*1000 for i in range(n_slices)] 104 regions_ends = [r-1 for r in regions_start[1:]] 105 slice_source_at_stamps(self.source_file, regions_start, regions_ends, 106 output_dir = self.output_dir) 107 written_samples = count_samples_in_directory(self.output_dir) 108 original_samples = count_samples_in_file(self.source_file) 109 total_files = count_files_in_directory(self.output_dir) 110 assert_equal(n_slices, total_files, 111 "number of slices created different from expected") 112 assert_equal(written_samples, original_samples, 113 "number of samples written different from number of original samples") 114 94 115 def tearDown(self): 95 116 shutil.rmtree(self.output_dir) … … 134 155 regions_end = None 135 156 slice_source_at_stamps (self.source_file, regions_start, regions_end, 136 output_dir = self.output_dir )157 output_dir = self.output_dir, create_first=True) 137 158 total_files = count_files_in_directory(self.output_dir) 138 159 assert_equal(n_slices, total_files,
Note: See TracChangeset
for help on using the changeset viewer.