Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iver56 committed Sep 7, 2023
1 parent 67c236f commit fb9f603
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions tests/test_apply_impulse_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_apply_impulse_response(self):
)

# Check that misc_file.txt is not one of the IR file candidates, as it's not audio
assert len(add_ir_transform.ir_files) == 1
assert len(add_ir_transform.ir_files) == 2

augmenter = Compose([add_ir_transform])

Expand All @@ -28,9 +28,7 @@ def test_apply_impulse_response(self):

# Check parameters
assert augmenter.transforms[0].parameters["should_apply"]
assert augmenter.transforms[0].parameters["ir_file_path"] == os.path.join(
DEMO_DIR, "ir", "impulse_response_0.wav"
)
assert augmenter.transforms[0].parameters["ir_file_path"].endswith(".wav")

assert samples_out.dtype == np.float32
assert samples_out.shape == samples_in.shape
Expand All @@ -48,7 +46,7 @@ def test_apply_impulse_response_multi_channel(self):
)

# Check that misc_file.txt is not one of the IR file candidates, as it's not audio
assert len(add_ir_transform.ir_files) == 1
assert len(add_ir_transform.ir_files) == 2

augmenter = Compose([add_ir_transform])

Expand All @@ -57,9 +55,7 @@ def test_apply_impulse_response_multi_channel(self):

# Check parameters
assert augmenter.transforms[0].parameters["should_apply"]
assert augmenter.transforms[0].parameters["ir_file_path"] == os.path.join(
DEMO_DIR, "ir", "impulse_response_0.wav"
)
assert augmenter.transforms[0].parameters["ir_file_path"].endswith(".wav")

assert samples_out.dtype == np.float32
assert samples_out.shape == samples_in.shape
Expand Down
4 changes: 2 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def test_find_audio_files_multiple_dirs(self):
file_paths = find_audio_files_in_paths(
[os.path.join(DEMO_DIR, "short_noises"), os.path.join(DEMO_DIR, "ir")]
)
assert len(file_paths) == 6
assert len(file_paths) == 7
assert file_paths[0].name == "130921_iPhone_rub_channel0_chunk83_aug2.wav"
assert file_paths[-1].name == "impulse_response_0.wav"
assert file_paths[-1].name == "rir48000.wav"

def test_calculate_rms_stereo(self):
np.random.seed(42)
Expand Down

0 comments on commit fb9f603

Please sign in to comment.