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 / unittest_checker_strings.py @ 745
History | View | Annotate | Download (1.5 KB)
1 |
# Copyright (c) 2003-2015 LOGILAB S.A. (Paris, FRANCE).
|
---|---|
2 |
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
3 |
#
|
4 |
# This program is free software; you can redistribute it and/or modify it under
|
5 |
# the terms of the GNU General Public License as published by the Free Software
|
6 |
# Foundation; either version 2 of the License, or (at your option) any later
|
7 |
# version.
|
8 |
#
|
9 |
# This program is distributed in the hope that it will be useful, but WITHOUT
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
11 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
12 |
#
|
13 |
# You should have received a copy of the GNU General Public License along with
|
14 |
# this program; if not, write to the Free Software Foundation, Inc.,
|
15 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
16 |
|
17 |
import sys |
18 |
import unittest |
19 |
|
20 |
from astroid import test_utils |
21 |
|
22 |
from pylint.checkers import strings |
23 |
from pylint.testutils import CheckerTestCase |
24 |
|
25 |
|
26 |
class StringCheckerTest(CheckerTestCase): |
27 |
CHECKER_CLASS = strings.StringFormatChecker |
28 |
|
29 |
@unittest.skipUnless(sys.version_info > (3, 0), |
30 |
"Tests that the string formatting checker "
|
31 |
"doesn't fail when encountering a bytes "
|
32 |
"string with a .format call")
|
33 |
def test_format_bytes(self): |
34 |
code = "b'test'.format(1, 2)"
|
35 |
node = test_utils.extract_node(code) |
36 |
with self.assertNoMessages(): |
37 |
self.checker.visit_call(node)
|
38 |
|
39 |
|
40 |
if __name__ == '__main__': |
41 |
unittest.main() |