assert (Path(f) / "test.txt").read_text() == "Testing!\n" # fixit shows an error
testcase.py@11:11 CompareSingletonPrimitivesByIs: Comparisons to singleton primitives should not be done with == or !=, as they check equality rather than identiy. Use `is` or `is not` instead. (has autofix)
--- a/testcase.py
+++ b/testcase.py
@@ -10,2 +10,2 @@
assert (Path(f) / "test.txt").samefile(fn_) # Assert passes, so they are identical
- assert (Path(f) / "test.txt").read_text() == "Testing!\n" # fixit shows an error
+ assert (Path(f) / "test.txt").read_text() is "Testing!\n" # fixit shows an error
🛠️ 1 file checked, 1 file with errors, 1 auto-fix available 🛠️
testcase.py@11:11 CompareSingletonPrimitivesByIs: Comparisons to singleton primitives should not be done with == or !=, as they check equality rather than identiy. Use `is` or `is not` instead. (has autofix)
🛠️ 1 file checked, 1 file with errors, 1 auto-fix available, 1 fix applied 🛠️
assert (Path(f) / "test.txt").read_text() is "Testing!\n" # fixit shows an error
Run the command again, you will get this second set of fixes back to the original:
assert (Path(f) / "test.txt").read_text() is "Testing!\n" # fixit shows an error
testcase.py@11:11 ComparePrimitivesByEqual: Don't use `is` or `is not` to compare primitives, as they compare references. Use == or != instead. (has autofix)
--- a/testcase.py
+++ b/testcase.py
@@ -10,2 +10,2 @@
assert (Path(f) / "test.txt").samefile(fn_) # Assert passes, so they are identical
- assert (Path(f) / "test.txt").read_text() is "Testing!\n" # fixit shows an error
+ assert (Path(f) / "test.txt").read_text() == "Testing!\n" # fixit shows an error
🛠️ 1 file checked, 1 file with errors, 1 auto-fix available 🛠️
testcase.py@11:11 ComparePrimitivesByEqual: Don't use `is` or `is not` to compare primitives, as they compare references. Use == or != instead. (has autofix)
🛠️ 1 file checked, 1 file with errors, 1 auto-fix available, 1 fix applied 🛠️
assert (Path(f) / "test.txt").read_text() == "Testing!\n" # fixit shows an error
Run the command over and over again, it will keep suggesting and applying the fix in the circular manner repeatedly.
Create a
testcase.py
file:Run the following command once:
You will get the first output:
Run the command again, you will get this second set of fixes back to the original:
Run the command over and over again, it will keep suggesting and applying the fix in the circular manner repeatedly.
libcst 1.0.1 fixit 2.0.0.post1