MCPcopy Create free account
hub / github.com/PyCQA/isort / test_python_version

Function test_python_version

tests/unit/test_isort.py:4520–4537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4518
4519
4520def test_python_version() -> None:
4521 # test that the py_version can be added as flag
4522 args = parse_args(["--py=27"])
4523 assert args["py_version"] == "27"
4524
4525 args = parse_args(["--python-version=3"])
4526 assert args["py_version"] == "3"
4527
4528 test_input = "import os\n\nimport user\n"
4529 assert isort.code(test_input, py_version="3") == test_input
4530
4531 # user is part of the standard library in python 2
4532 output_python_2 = "import os\nimport user\n"
4533 assert isort.code(test_input, py_version="27") == output_python_2
4534
4535 test_input = "import os\nimport xml"
4536
4537 print(isort.code(test_input, py_version="all"))
4538
4539
4540def test_isort_with_single_character_import() -> None:

Callers

nothing calls this directly

Calls 1

parse_argsFunction · 0.90

Tested by

no test coverage detected