Skip to content

Commit 70713b7

Browse files
committed
Update
[ghstack-poisoned]
2 parents 7fefac5 + 8e4a3fb commit 70713b7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

test/rb/test_rb_transforms.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,15 @@ def test_filters_dynamically_on_sample(self):
541541
assert len(rb) == 4
542542
assert rb.sample(4).batch_size[0] == 4
543543
# The policy moved on: version-2 data became stale since insertion.
544+
# The random sampler draws with replacement, so the batch size is
545+
# not deterministic; the invariant is that no stale element passes.
544546
current["version"] = 4
545547
sample = rb.sample(4)
546-
assert sample.batch_size[0] < 4
547548
assert (sample["policy_version"] == 3).all()
549+
# Once everything is stale the batch is deterministically empty.
550+
current["version"] = 10
551+
sample = rb.sample(4)
552+
assert sample.batch_size[0] == 0
548553

549554
def test_nested_version_key(self):
550555
rb = ReplayBuffer(

0 commit comments

Comments
 (0)