gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / functional / string_formatting_py27.py @ 745
History | View | Annotate | Download (932 Bytes)
1 |
"""test for Python 2 string formatting error
|
---|---|
2 |
"""
|
3 |
from __future__ import unicode_literals |
4 |
# pylint: disable=line-too-long
|
5 |
__revision__ = 1
|
6 |
|
7 |
def pprint_bad(): |
8 |
"""Test string format """
|
9 |
"{{}}".format(1) # [too-many-format-args] |
10 |
"{} {".format() # [bad-format-string] |
11 |
"{} }".format() # [bad-format-string] |
12 |
"{0} {}".format(1, 2) # [format-combined-specification] |
13 |
# +1: [missing-format-argument-key, unused-format-string-argument]
|
14 |
"{a} {b}".format(a=1, c=2) |
15 |
"{} {a}".format(1, 2) # [missing-format-argument-key] |
16 |
"{} {}".format(1) # [too-few-format-args] |
17 |
"{} {}".format(1, 2, 3) # [too-many-format-args] |
18 |
# +1: [missing-format-argument-key,missing-format-argument-key,missing-format-argument-key]
|
19 |
"{a} {b} {c}".format()
|
20 |
"{} {}".format(a=1, b=2) # [too-few-format-args] |
21 |
# +1: [missing-format-argument-key, missing-format-argument-key]
|
22 |
"{a} {b}".format(1, 2) |
23 |
|