2016-06-01 15:11:29 +00:00
|
|
|
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
|
2015-04-01 10:47:51 +00:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from astroid import test_utils
|
|
|
|
|
|
|
|
from pylint.checkers import strings
|
|
|
|
from pylint.testutils import CheckerTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class StringCheckerTest(CheckerTestCase):
|
2016-01-13 14:21:47 +00:00
|
|
|
CHECKER_CLASS = strings.StringFormatChecker
|
2015-04-01 10:47:51 +00:00
|
|
|
|
|
|
|
@unittest.skipUnless(sys.version_info > (3, 0),
|
|
|
|
"Tests that the string formatting checker "
|
|
|
|
"doesn't fail when encountering a bytes "
|
|
|
|
"string with a .format call")
|
|
|
|
def test_format_bytes(self):
|
|
|
|
code = "b'test'.format(1, 2)"
|
|
|
|
node = test_utils.extract_node(code)
|
|
|
|
with self.assertNoMessages():
|
2015-08-26 19:09:27 +00:00
|
|
|
self.checker.visit_call(node)
|
2015-04-01 10:47:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|