Skip to content

Commit e829bfe

Browse files
committed
test(dumper): verify capture_output respects filter
1 parent 681c86e commit e829bfe

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/registered/debug_utils/test_dumper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,16 @@ def test_capture_output_value_cloned(self, tmp_path):
359359
tensor.fill_(999.0)
360360
assert torch.equal(captured["clone_check"]["value"], torch.zeros(3, 3))
361361

362+
def test_capture_output_respects_filter(self, tmp_path):
363+
d = _make_test_dumper(tmp_path, filter="^keep")
364+
365+
with d.capture_output() as captured:
366+
d.dump("keep_this", torch.randn(3, 3))
367+
d.dump("skip_this", torch.randn(3, 3))
368+
369+
assert "keep_this" in captured
370+
assert "skip_this" not in captured
371+
362372

363373
class TestDumpDictFormat:
364374
"""Verify that dump files use the dict output format: {"value": ..., "meta": {...}}."""

0 commit comments

Comments
 (0)