Skip to content

Commit

Permalink
Manual fix the implicit string/bytes concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Feb 1, 2024
1 parent babcdce commit 195f1ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions testing/test_assertrewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,13 +1867,13 @@ def test_simple():
id="assert statement not on own line",
),
pytest.param(
b"def x():\n" b" assert 1\n" b" assert 1+2\n",
b"def x():\n assert 1\n assert 1+2\n",
{2: "1", 3: "1+2"},
id="multiple assertions",
),
pytest.param(
# changes in encoding cause the byte offsets to be different
"# -*- coding: latin1\n" "def ÀÀÀÀÀ(): assert 1\n".encode("latin1"),
"# -*- coding: latin1\ndef ÀÀÀÀÀ(): assert 1\n".encode("latin1"),
{2: "1"},
id="latin1 encoded on first line\n",
),
Expand All @@ -1884,22 +1884,22 @@ def test_simple():
id="utf-8 encoded on first line",
),
pytest.param(
b"def x():\n" b" assert (\n" b" 1 + 2 # comment\n" b" )\n",
b"def x():\n assert (\n 1 + 2 # comment\n )\n",
{2: "(\n 1 + 2 # comment\n )"},
id="multi-line assertion",
),
pytest.param(
b"def x():\n" b" assert y == [\n" b" 1, 2, 3\n" b" ]\n",
b"def x():\n assert y == [\n 1, 2, 3\n ]\n",
{2: "y == [\n 1, 2, 3\n ]"},
id="multi line assert with list continuation",
),
pytest.param(
b"def x():\n" b" assert 1 + \\\n" b" 2\n",
b"def x():\n assert 1 + \\\n 2\n",
{2: "1 + \\\n 2"},
id="backslash continuation",
),
pytest.param(
b"def x():\n" b" assert x, y\n",
b"def x():\n assert x, y\n",
{2: "x"},
id="assertion with message",
),
Expand Down
2 changes: 1 addition & 1 deletion testing/test_cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def test_1(): assert 1
)

p1.write_text(
"def test_1(): assert 1\n" "def test_2(): assert 1\n", encoding="utf-8"
"def test_1(): assert 1\ndef test_2(): assert 1\n", encoding="utf-8"
)
os.utime(p1, ns=(p1.stat().st_atime_ns, int(1e9)))

Expand Down

0 comments on commit 195f1ea

Please sign in to comment.