def test_streaming_output_success() -> None:
    results = TypecheckResults([TypecheckResult(0, "stdout", "stderr")],
                               typechecker_name="typchecker")
    assert results.level() == LogLevel.INFO
    assert results.message() == dedent("""\
        succeeded.
        stdout
        stderr

        """)
def test_streaming_output_failure() -> None:
    results = TypecheckResults([TypecheckResult(18, "stdout", "stderr")],
                               typechecker_name="typchecker")
    assert results.level() == LogLevel.WARN
    assert results.message() == dedent("""\
        failed (exit code 18).
        stdout
        stderr

        """)
def test_streaming_output_partitions() -> None:
    results = TypecheckResults(
        [
            TypecheckResult(21, "", "", partition_description="ghc8.1"),
            TypecheckResult(
                0, "stdout", "stderr", partition_description="ghc9.2"),
        ],
        typechecker_name="typchecker",
    )
    assert results.level() == LogLevel.WARN
    assert results.message() == dedent("""\
        failed (exit code 21).
        Partition #1 - ghc8.1:

        Partition #2 - ghc9.2:
        stdout
        stderr

        """)
def test_streaming_output_skip() -> None:
    results = TypecheckResults([], typechecker_name="typchecker")
    assert results.level() == LogLevel.DEBUG
    assert results.message() == "skipped."