diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes.py new file mode 100644 index 000000000000..dfd7410367b7 --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes.py @@ -0,0 +1 @@ +print(b'Hello %b!' % b'World') \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes_after.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes_after.py new file mode 100644 index 000000000000..ff35dd5a2ed9 --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/bytes_after.py @@ -0,0 +1 @@ +print(b'Hello %b!' % b'World') \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference.py new file mode 100644 index 000000000000..f0eaf9e0aa8c --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference.py @@ -0,0 +1,2 @@ +data = dict(first='Hodor', last='Hodor!') +print('%(first)s %(last)s' % data) \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference_after.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference_after.py new file mode 100644 index 000000000000..f86887fc7915 --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictCallReference_after.py @@ -0,0 +1,2 @@ +data = dict(first='Hodor', last='Hodor!') +print('{first} {last}'.format(**data)) \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference.py new file mode 100644 index 000000000000..bc80c96e81f8 --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference.py @@ -0,0 +1,2 @@ +data = {'first': 'Hodor', 'last': 'Hodor!'} +print('%(first)s %(last)s' % data) \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference_after.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference_after.py new file mode 100644 index 000000000000..1670abe3e4fe --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/dictReference_after.py @@ -0,0 +1,2 @@ +data = {'first': 'Hodor', 'last': 'Hodor!'} +print('{first} {last}'.format(**data)) \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference.py new file mode 100644 index 000000000000..1d2556e2b448 --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference.py @@ -0,0 +1,2 @@ +coord = (3, 5) +print('X: %s; Y: %s' % coord) \ No newline at end of file diff --git a/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference_after.py b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference_after.py new file mode 100644 index 000000000000..079f42631fdd --- /dev/null +++ b/python/testData/intentions/PyConvertFormatOperatorToMethodIntentionTest/tupleReference_after.py @@ -0,0 +1,2 @@ +coord = (3, 5) +print('X: {}; Y: {}'.format(*coord)) \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java b/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java index 833f71e8452a..2035d51c9dab 100644 --- a/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java +++ b/python/testSrc/com/jetbrains/python/intentions/PyConvertFormatOperatorToMethodIntentionTest.java @@ -43,4 +43,24 @@ public class PyConvertFormatOperatorToMethodIntentionTest extends PyIntentionTes public void testConcatenated() { doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26); } + + // PY-20752 + public void testTupleReference() { + doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26); + } + + // PY-20798 + public void testDictReference() { + doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26); + } + + // PY-20798 + public void testDictCallReference() { + doTest(PyBundle.message("INTN.replace.with.method"), LanguageLevel.PYTHON26); + } + + // PY-20754 + public void testBytes() { + doNegativeTest(PyBundle.message("INTN.replace.with.method")); + } } \ No newline at end of file