Repository: pypa/pip
File: tests/functional/test_list.py (Python)

Code before:
def test_multiple_exclude_and_normalization(
    script: PipTestEnvironment, tmpdir: Path
) -> None:
    req_path = wheel.make_wheel(name="Normalizable_Name", version="1.0").save_to_dir(
        tmpdir
    )
    script.pip("install", "--no-index", req_path)
    result = script.pip("list")
    print(result.stdout)
    assert "Normalizable_Name" in result.stdout
    assert "pip" in result.stdout
    result = script.pip("list", "--exclude", "normalizablE-namE", "--exclude", "pIp")
    assert "Normalizable_Name" not in result.stdout
    assert "pip" not in result.stdout


@pytest.mark.usefixtures("enable_user_site")
def test_user_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --user flag in the list command

    """
    script.pip_install_local("simplewheel==1.0")
    script.pip_install_local("--user", "simple.dist==0.1")
    result = script.pip("list", "--user", "--format=json")
    assert {"name": "simple", "version": "1.0"} not in json.loads(result.stdout)
    assert {"name": "simple.dist", "version": "0.1"} in json.loads(result.stdout)


@pytest.mark.usefixtures("enable_user_site")
def test_user_columns_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --user --format=columns flags in the list command

    """
    script.pip_install_local("simplewheel==1.0")
    script.pip_install_local("--user", "simple.dist==0.1")
    result = script.pip("list", "--user", "--format=columns")
    assert "Package" in result.stdout
    assert "Version" in result.stdout
    assert "simplewheel (2.0)" not in result.stdout
    assert "simple.dist 0.1" in result.stdout, str(result)


@pytest.mark.network
def test_uptodate_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --uptodate flag in the list command

    """
    script.pip(

Review comment (suggestion):
```suggestion
    assert {"name": "simplewheel", "version": "1.0"} not in json.loads(result.stdout)
```

Code after:
def test_multiple_exclude_and_normalization(
    script: PipTestEnvironment, tmpdir: Path
) -> None:
    req_path = wheel.make_wheel(name="Normalizable_Name", version="1.0").save_to_dir(
        tmpdir
    )
    script.pip("install", "--no-index", req_path)
    result = script.pip("list")
    print(result.stdout)
    assert "Normalizable_Name" in result.stdout
    assert "pip" in result.stdout
    result = script.pip("list", "--exclude", "normalizablE-namE", "--exclude", "pIp")
    assert "Normalizable_Name" not in result.stdout
    assert "pip" not in result.stdout


@pytest.mark.usefixtures("enable_user_site")
def test_user_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --user flag in the list command

    """
    script.pip_install_local("simplewheel==1.0")
    script.pip_install_local("--user", "simple.dist==0.1")
    result = script.pip("list", "--user", "--format=json")
    assert {"name": "simplewheel", "version": "1.0"} not in json.loads(result.stdout)
    assert {"name": "simple.dist", "version": "0.1"} in json.loads(result.stdout)


@pytest.mark.usefixtures("enable_user_site")
def test_user_columns_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --user --format=columns flags in the list command

    """
    script.pip_install_local("simplewheel==1.0")
    script.pip_install_local("--user", "simple.dist==0.1")
    result = script.pip("list", "--user", "--format=columns")
    assert "Package" in result.stdout
    assert "Version" in result.stdout
    assert "simple.dist (2.0)" not in result.stdout
    assert "simple.dist 0.1" in result.stdout, str(result)


@pytest.mark.network
def test_uptodate_flag(script: PipTestEnvironment, data: TestData) -> None:
    """
    Test the behavior of --uptodate flag in the list command

    """
    script.pip(