Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

unittest_checker_strings.py 931B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) 2015-2017 Claudiu Popa <pcmanticore@gmail.com>
  2. # Copyright (c) 2016 Derek Gustafson <degustaf@gmail.com>
  3. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  4. # For details: https://github.com/PyCQA/pylint/blob/master/COPYING
  5. import sys
  6. import pytest
  7. import astroid
  8. from pylint.checkers import strings
  9. from pylint.testutils import CheckerTestCase
  10. class TestStringChecker(CheckerTestCase):
  11. CHECKER_CLASS = strings.StringFormatChecker
  12. @pytest.mark.skipif(sys.version_info <= (3, 0), reason=""
  13. "Tests that the string formatting checker "
  14. "doesn't fail when encountering a bytes "
  15. "string with a .format call")
  16. def test_format_bytes(self):
  17. code = "b'test'.format(1, 2)"
  18. node = astroid.extract_node(code)
  19. with self.assertNoMessages():
  20. self.checker.visit_call(node)