summaryrefslogtreecommitdiff
path: root/python/testData/inspections/PyStringFormatInspection
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-08-21 00:31:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-08-16 04:55:08 +0000
commit9cde0e3c015174898df8b8f3672185941fad4786 (patch)
tree80a55c7b59c38377216daaada4e8bc47b69ceb9a /python/testData/inspections/PyStringFormatInspection
parent3b37877a2561bf9fbe072253a18688807d523505 (diff)
parentd76e3920c56d37c942092b7dca20fcaded81c0a5 (diff)
downloadidea-9cde0e3c015174898df8b8f3672185941fad4786.tar.gz
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'python/testData/inspections/PyStringFormatInspection')
-rw-r--r--python/testData/inspections/PyStringFormatInspection/expected.xml16
-rw-r--r--python/testData/inspections/PyStringFormatInspection/src/string-format.py24
2 files changed, 39 insertions, 1 deletions
diff --git a/python/testData/inspections/PyStringFormatInspection/expected.xml b/python/testData/inspections/PyStringFormatInspection/expected.xml
index 62301ce56510..25e70285bd8d 100644
--- a/python/testData/inspections/PyStringFormatInspection/expected.xml
+++ b/python/testData/inspections/PyStringFormatInspection/expected.xml
@@ -160,4 +160,20 @@
<line>99</line>
<description>Too few arguments for format string</description>
</problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>103</line>
+ <description>Unexpected type</description>
+ </problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>104</line>
+ <description>Too few arguments for format string</description>
+ </problem>
+ <problem>
+ <file>string-format.py</file>
+ <line>105</line>
+ <description>Too many arguments for format string</description>
+ </problem>
+
</problems>
diff --git a/python/testData/inspections/PyStringFormatInspection/src/string-format.py b/python/testData/inspections/PyStringFormatInspection/src/string-format.py
index e60e4bb90911..972aaed6423a 100644
--- a/python/testData/inspections/PyStringFormatInspection/src/string-format.py
+++ b/python/testData/inspections/PyStringFormatInspection/src/string-format.py
@@ -96,4 +96,26 @@ print '%d' % string[:2]
my_tuple = (1,2,3,4,5,6,7,8)
print '%d, %d' % my_tuple[:7:3]
print '%d, %d, %d' % my_tuple[:7:3]
-print '%d, %d, %d, %d' % my_tuple[:7:3] \ No newline at end of file
+print '%d, %d, %d, %d' % my_tuple[:7:3]
+
+# PY-12801
+print '%d %s' % ((42,) + ('spam',))
+print '%d %s' % (('ham',) + ('spam',))
+print '%d %s' % ((42,) + ())
+print '%d' % ((42,) + ('spam',))
+
+# PY-11274
+import collections
+print '%(foo)s' % collections.OrderedDict(foo=None)
+
+class MyDict(collections.Mapping):
+ def __getitem__(self, key):
+ return 'spam'
+
+ def __iter__(self):
+ yield 'spam'
+
+ def __len__(self):
+ return 1
+
+print '%(foo)s' % MyDict()