Skip to content

Commit ad1dd3a

Browse files
committed
Simplify even further
1 parent da59be4 commit ad1dd3a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/samplers/test_samplers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_sampling_range(
209209
)
210210
with cm:
211211
for clip in clips:
212-
assert_tensor_equal(clip.data, clips.data[0])
212+
assert_tensor_equal(clip.data, clips[0].data)
213213

214214

215215
@pytest.mark.parametrize("sampler", (clips_at_random_indices, clips_at_regular_indices))
@@ -236,11 +236,11 @@ def test_sampling_range_negative(sampler):
236236
)
237237

238238
# There is only one unique clip in clips_1...
239-
for clip_1 in clips_1:
240-
assert_tensor_equal(clip_1.data, clips_1.data[0])
239+
for clip in clips_1:
240+
assert_tensor_equal(clip.data, clips_1[0].data)
241241
# ... and it's the same that's in clips_2
242-
for clip_2 in clips_2:
243-
assert_tensor_equal(clip_2.data, clips_1.data[0])
242+
for clip in clips_2:
243+
assert_tensor_equal(clip.data, clips_1[0].data)
244244

245245

246246
@pytest.mark.parametrize(
@@ -399,7 +399,7 @@ def test_random_sampler_randomness(sampler):
399399
torch.manual_seed(1)
400400
clips_3 = sampler(decoder, num_clips=num_clips)
401401
with pytest.raises(AssertionError, match="Tensor-likes are not"):
402-
assert_tensor_equal(clips_1.data[0], clips_3.data[0])
402+
assert_tensor_equal(clips_1[0].data, clips_3[0].data)
403403

404404
# Make sure we didn't alter the builtin Python RNG
405405
builtin_random_state_end = random.getstate()

0 commit comments

Comments
 (0)