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 / logging_format_interpolation.py @ 745
History | View | Annotate | Download (1005 Bytes)
1 |
# pylint: disable=E1101, no-absolute-import, import-error,line-too-long, missing-docstring,wrong-import-order
|
---|---|
2 |
|
3 |
try:
|
4 |
import __builtin__ as builtins |
5 |
except ImportError: |
6 |
import builtins |
7 |
|
8 |
# Muck up the names in an effort to confuse...
|
9 |
import logging as renamed_logging |
10 |
import os as logging |
11 |
|
12 |
FORMAT_STR = '{0}, {1}'
|
13 |
|
14 |
# Statements that should be flagged:
|
15 |
renamed_logging.debug('{0}, {1}'.format(4, 5)) # [logging-format-interpolation] |
16 |
renamed_logging.log(renamed_logging.DEBUG, 'msg: {}'.format('Run!')) # [logging-format-interpolation] |
17 |
renamed_logging.debug(FORMAT_STR.format(4, 5)) # [logging-format-interpolation] |
18 |
renamed_logging.log(renamed_logging.DEBUG, FORMAT_STR.format(4, 5)) # [logging-format-interpolation] |
19 |
|
20 |
# Statements that should not be flagged:
|
21 |
renamed_logging.debug(format(66, 'x')) |
22 |
renamed_logging.debug(builtins.format(66, 'x')) |
23 |
renamed_logging.log(renamed_logging.DEBUG, 'msg: Run!'.upper())
|
24 |
logging.debug('{0}, {1}'.format(4, 5)) |
25 |
logging.log(logging.DEBUG, 'msg: {}'.format('Run!')) |