Skip to content

Commit

Permalink
Test parameter ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
iver56 committed Mar 13, 2024
1 parent e6fb493 commit 4b1ba29
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_bit_crush.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def test_single_channel(self):

assert samples.dtype == distorted_samples.dtype
assert samples.shape == distorted_samples.shape
assert 2**augmenter.parameters["bit_depth"] + 1 > len(np.unique(np.round(distorted_samples, 5)))
assert 2 ** augmenter.parameters["bit_depth"] + 1 > len(
np.unique(np.round(distorted_samples, 5))
)

def test_multichannel(self):
num_channels = 3
Expand All @@ -26,5 +28,14 @@ def test_multichannel(self):

assert samples.dtype == distorted_samples.dtype
assert samples.shape == distorted_samples.shape
assert 2**augmenter.parameters["bit_depth"] + 1 > len(np.unique(np.round(distorted_samples, 5)))

assert 2 ** augmenter.parameters["bit_depth"] + 1 > len(
np.unique(np.round(distorted_samples, 5))
)

def test_param_range(self):
with pytest.raises(ValueError):
BitCrush(min_bit_depth=0, max_bit_depth=6, p=1.0)
with pytest.raises(ValueError):
BitCrush(min_bit_depth=7, max_bit_depth=64, p=1.0)
with pytest.raises(ValueError):
BitCrush(min_bit_depth=8, max_bit_depth=6, p=1.0)

0 comments on commit 4b1ba29

Please sign in to comment.