-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document new codemod and register it
- Loading branch information
1 parent
07dd6a0
commit 50a61fb
Showing
6 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from core_codemods.fix_assert_tuple import FixAssertTuple | ||
from integration_tests.base_test import ( | ||
BaseIntegrationTest, | ||
original_and_expected_from_code_path, | ||
) | ||
|
||
|
||
class TestFixAssertTuple(BaseIntegrationTest): | ||
codemod = FixAssertTuple | ||
code_path = "tests/samples/fix_assert_tuple.py" | ||
original_code, expected_new_code = original_and_expected_from_code_path( | ||
code_path, [(0, "assert 1 == 1\n"), (1, "assert 2 == 2\n")] | ||
) | ||
expected_diff = "--- \n+++ \n@@ -1 +1,2 @@\n-assert (1 == 1, 2 == 2)\n+assert 1 == 1\n+assert 2 == 2\n" | ||
expected_line_change = "1" | ||
change_description = FixAssertTuple.change_description | ||
num_changes = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
An assertion on a non-empty tuple will always evaluate to `True` so it's likely to be written unintentionally. This codemod will write one assert statement for each item in the tuple. | ||
|
||
|
||
|
||
The changes from this codemod look like this: | ||
|
||
```diff | ||
- assert (1 == 1, 2 == 2) | ||
+ assert 1 == 1 | ||
+ assert 2 == 2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assert (1 == 1, 2 == 2) |