Skip to content

Commit

Permalink
Improve coveage
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Nov 25, 2021
1 parent 3345c4d commit 3ddd965
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions tests/unit/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,89 @@ def test_titled_and_footered_imports() -> None:
"# My Stuff End\n"
)

test_input_lines_down = (
"# comment 1\n"
"import django.settings\n"
"\n"
"# Standard Library\n"
"import sys\n"
"import unicodedata\n"
"import statistics\n"
"import os\n"
"import myproject.test\n"
"\n"
"# Standard Library End\n"
"# Standard Library End\n"
)
test_output_lines_down = isort.code(
code=test_input_lines_down,
known_first_party=["myproject"],
import_heading_stdlib="Standard Library",
import_heading_firstparty="My Stuff",
import_footer_stdlib="Standard Library End",
import_footer_firstparty="My Stuff End",
dedup_headings=True,
)
assert test_output_lines_down == (
"# comment 1\n"
"# Standard Library\n"
"import os\n"
"import statistics\n"
"import sys\n"
"import unicodedata\n"
"\n"
"# Standard Library End\n"
"\n"
"import django.settings\n"
"\n"
"# My Stuff\n"
"import myproject.test\n"
"\n"
"# My Stuff End\n"
)

test_input_lines_down = (
"# comment 1\n"
"# Standard Library\n"
"import os\n"
"import statistics\n"
"import sys\n"
"import unicodedata\n"
"\n"
"# Standard Library End\n"
"\n"
"import django.settings\n"
"\n"
"# My Stuff\n"
"import myproject.test\n"
)
test_output_lines_down = isort.code(
code=test_input_lines_down,
known_first_party=["myproject"],
import_heading_stdlib="Standard Library",
import_heading_firstparty="My Stuff",
import_footer_stdlib="Standard Library End",
import_footer_firstparty="My Stuff End",
dedup_headings=True,
)
assert test_output_lines_down == (
"# comment 1\n"
"# Standard Library\n"
"import os\n"
"import statistics\n"
"import sys\n"
"import unicodedata\n"
"\n"
"# Standard Library End\n"
"\n"
"import django.settings\n"
"\n"
"# My Stuff\n"
"import myproject.test\n"
"\n"
"# My Stuff End\n"
)


def test_balanced_wrapping() -> None:
"""Tests balanced wrapping mode, where the length of individual lines maintain width."""
Expand Down

0 comments on commit 3ddd965

Please sign in to comment.