def test_streaming_output_not_changed(caplog) -> None: caplog.set_level(logging.DEBUG) result = FmtResult( input=EMPTY_SNAPSHOT, output=EMPTY_SNAPSHOT, stdout="stdout", stderr="stderr", formatter_name="formatter", ) assert result.level() == LogLevel.INFO assert result.message() == "formatter made no changes." assert ["Output from formatter\nstdout\nstderr"] == [ rec.message for rec in caplog.records if rec.levelno == logging.DEBUG ]
def test_streaming_output_not_changed() -> None: result = FmtResult( input=EMPTY_DIGEST, output=EMPTY_DIGEST, stdout="stdout", stderr="stderr", formatter_name="formatter", ) assert result.level() == LogLevel.INFO assert result.message() == dedent("""\ made no changes. stdout stderr """)
def test_streaming_output_changed() -> None: changed_digest = Digest(EMPTY_DIGEST.fingerprint, 2) result = FmtResult( input=EMPTY_DIGEST, output=changed_digest, stdout="stdout", stderr="stderr", formatter_name="formatter", ) assert result.level() == LogLevel.WARN assert result.message() == dedent("""\ made changes. stdout stderr """)
def test_streaming_output_changed(caplog) -> None: caplog.set_level(logging.DEBUG) changed_digest = Digest(EMPTY_DIGEST.fingerprint, 2) changed_snapshot = Snapshot._unsafe_create(changed_digest, [], []) result = FmtResult( input=EMPTY_SNAPSHOT, output=changed_snapshot, stdout="stdout", stderr="stderr", formatter_name="formatter", ) assert result.level() == LogLevel.WARN assert result.message() == "formatter made changes." assert ["Output from formatter\nstdout\nstderr"] == [ rec.message for rec in caplog.records if rec.levelno == logging.DEBUG ]
def test_streaming_output_changed() -> None: changed_digest = Digest(EMPTY_DIGEST.fingerprint, 2) changed_snapshot = Snapshot._unsafe_create(changed_digest, [], []) result = FmtResult( input=EMPTY_SNAPSHOT, output=changed_snapshot, stdout="stdout", stderr="stderr", formatter_name="formatter", ) assert result.level() == LogLevel.WARN assert result.message() == dedent( """\ formatter made changes. stdout stderr """ )