コード例 #1
0
ファイル: test_slicing.py プロジェクト: uchitsa/sonic-pi
 def tearDown(self):
     original_samples = count_samples_in_file(self.source_file)
     written_samples = count_samples_in_directory(self.output_dir)
     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")
     shutil.rmtree(self.output_dir)
コード例 #2
0
ファイル: test_slicing.py プロジェクト: uchitsa/sonic-pi
 def test_slice_start_and_ends_no_gap(self):
     regions_start = [i*1000 for i in range(n_slices)]
     regions_ends = [start - 1 for start in regions_start[1:]] + [1e120]
     slice_source_at_stamps(self.source_file, regions_start, regions_ends,
             output_dir = self.output_dir)
     original_samples = count_samples_in_file(self.source_file)
     written_samples = count_samples_in_directory(self.output_dir)
     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")
コード例 #3
0
ファイル: test_slicing.py プロジェクト: uchitsa/sonic-pi
 def test_slice_no_ends(self):
     regions_start = [i*1000 for i in range(1, n_slices)]
     regions_end = None
     slice_source_at_stamps (self.source_file, regions_start, regions_end,
             output_dir = self.output_dir, create_first=True)
     total_files = count_files_in_directory(self.output_dir)
     assert_equal(n_slices, total_files,
         "number of slices created different from expected")
     original_samples = count_samples_in_file(self.source_file)
     written_samples = count_samples_in_directory(self.output_dir)
     assert_equal(written_samples, original_samples,
         "number of samples written different from number of original samples")
コード例 #4
0
ファイル: test_slicing.py プロジェクト: uchitsa/sonic-pi
 def test_slice_start_beyond_end(self):
     regions_start = [i*1000 for i in range(1, n_slices)]
     regions_start += [count_samples_in_file(self.source_file) + 1000]
     slice_source_at_stamps(self.source_file, regions_start,
             output_dir = self.output_dir, create_first=True)