3222b9728d9f07cbce611ba6c57ef0d640d033a6,src/python/pants/backend/python/lint/black/rules_integration_test.py,,test_works_with_python38,#Any#,195

Before Change


def test_works_with_python38(rule_runner: RuleRunner) -> None:
    Black"s typed-ast dependency does not understand Python 3.8, so we must instead run Black
    with Python 3.8 when relevant.
    py38_sources = FileContent(
        "py38.py",
        dedent(
            \
            import datetime

            x = True
            if y := x:
                print("x is truthy and now assigned to y")


            class Foo:
                pass
            
        ).encode(),
    )
    target = make_target(rule_runner, [py38_sources], interpreter_constraints=">=3.8")
    lint_results, fmt_result = run_black(rule_runner, [target])
    assert len(lint_results) == 1
    assert lint_results[0].exit_code == 0
    assert "1 file would be left unchanged" in lint_results[0].stderr

After Change


def test_works_with_python38(rule_runner: RuleRunner) -> None:
    Black"s typed-ast dependency does not understand Python 3.8, so we must instead run Black
    with Python 3.8 when relevant.
    content = dedent(
        \
        import datetime

        x = True
        if y := x:
            print("x is truthy and now assigned to y")


        class Foo:
            pass
        
    )
    rule_runner.write_files(
        {"f.py": content, "BUILD": "python_library(name="t", interpreter_constraints=[">=3.8"])"}
    )
    tgt = rule_runner.get_target(Address("", target_name="t", relative_file_path="f.py"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: 3222b9728d9f07cbce611ba6c57ef0d640d033a6
Time: 2021-04-05
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/lint/black/rules_integration_test.py
Class Name:
Method Name: test_works_with_python38


Project Name: pantsbuild/pants
Commit Name: 3222b9728d9f07cbce611ba6c57ef0d640d033a6
Time: 2021-04-05
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/lint/black/rules_integration_test.py
Class Name:
Method Name: test_works_with_python39


Project Name: pantsbuild/pants
Commit Name: 9228ad83a3ecde2fb5a714d1eb43c7c1ee2e200b
Time: 2020-04-15
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/lint/pylint/rules_integration_test.py
Class Name: PylintIntegrationTest
Method Name: test_includes_direct_dependencies