diff --git a/python/testData/inspections/AugmentAssignmentWithContext.py b/python/testData/inspections/AugmentAssignmentWithContext.py new file mode 100644 index 000000000000..e7a26bcccbb2 --- /dev/null +++ b/python/testData/inspections/AugmentAssignmentWithContext.py @@ -0,0 +1,4 @@ +class A: + x = 3 +a = A() +a.x = a.x + 1 \ No newline at end of file diff --git a/python/testData/inspections/AugmentAssignmentWithContext_after.py b/python/testData/inspections/AugmentAssignmentWithContext_after.py new file mode 100644 index 000000000000..56470da44af6 --- /dev/null +++ b/python/testData/inspections/AugmentAssignmentWithContext_after.py @@ -0,0 +1,4 @@ +class A: + x = 3 +a = A() +a.x += 1 \ No newline at end of file diff --git a/python/testData/inspections/PyAugmentAssignmentInspection/test.py b/python/testData/inspections/PyAugmentAssignmentInspection/test.py index bf91a1a9e638..9643d6d659ca 100644 --- a/python/testData/inspections/PyAugmentAssignmentInspection/test.py +++ b/python/testData/inspections/PyAugmentAssignmentInspection/test.py @@ -10,4 +10,6 @@ var_4 = 1 var_5 = var_5 + "string" var_6 = var_6 + var_4 -var_7 += 2 \ No newline at end of file +var_7 += 2 + +var = 2 + var # PY-2482 \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java index bc9f47b6e55c..e28884bb3703 100644 --- a/python/testSrc/com/jetbrains/python/PyQuickFixTest.java +++ b/python/testSrc/com/jetbrains/python/PyQuickFixTest.java @@ -179,6 +179,11 @@ public class PyQuickFixTest extends PyLightFixtureTestCase { PyBundle.message("QFIX.augment.assignment"), true, true); } + public void testAugmentAssignmentWithContext() { // PY-2481 + doInspectionTest("AugmentAssignmentWithContext.py", PyAugmentAssignmentInspection.class, + PyBundle.message("QFIX.augment.assignment"), true, true); + } + public void testChainedComparisons() { // PY-1020 doInspectionTest("ChainedComparisons.py", PyChainedComparisonsInspection.class, PyBundle.message("QFIX.chained.comparison"), true, true);