def test_lints(
    content: str,
    errors: LintErrors,
) -> None:
    """Test lints are identified correctly."""
    lints = list(
        linting.lint_file(
            file=StringIO(content),
            filename=None,
            checks=[checks.CheckHeaderTagsArray],
        ))

    assert lints == errors
def test_check_header_type_leading_slash(
    content: str,
    errors: LintErrors,
) -> None:
    """Test lints are identified correctly."""
    lints = set(
        linting.lint_file(
            file=StringIO(content),
            filename=None,
            checks=[checks.CheckHeaderTypeLeadingSlash],
        ))

    assert lints == set(errors)
def test_lints(
    content: str,
    errors: LintErrors,
) -> None:
    """Test lints are identified correctly."""
    lints = list(
        linting.lint_file(
            file=StringIO(""),
            filename=content,
            checks=[checks.CheckFilenameId],
        )
    )

    assert lints == errors
Esempio n. 4
0
def test_lints(
    content: str,
    line: Optional[int],
    column: Optional[int],
    error: Optional[str],
    checks: linting.LintChecks,
) -> None:
    """Test lints are identified correctly."""
    lints = list(
        linting.lint_file(
            file=StringIO(content),
            filename="stdin",
            checks=checks,
        )
    )

    if error and line and column:
        assert lints == [linting.LintError(line=line, column=column, error=error)]
    else:
        assert lints == []