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.

test_elseif_used.py 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (c) 2015-2017 Claudiu Popa <pcmanticore@gmail.com>
  2. # Copyright (c) 2015 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
  3. # Copyright (c) 2016-2017 Derek Gustafson <degustaf@gmail.com>
  4. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  5. # For details: https://github.com/PyCQA/pylint/blob/master/COPYING
  6. """Tests for the pylint checker in :mod:`pylint.extensions.check_elif
  7. """
  8. import os.path as osp
  9. import pytest
  10. from pylint.extensions.check_elif import ElseifUsedChecker
  11. @pytest.fixture(scope="module")
  12. def checker(checker):
  13. return ElseifUsedChecker
  14. def test_elseif_message(linter):
  15. elif_test = osp.join(osp.dirname(osp.abspath(__file__)), 'data',
  16. 'elif.py')
  17. linter.check([elif_test])
  18. msgs = linter.reporter.messages
  19. assert len(msgs) == 2
  20. for msg in msgs:
  21. assert msg.symbol == 'else-if-used'
  22. assert msg.msg == 'Consider using "elif" instead of "else if"'
  23. assert msgs[0].line == 9
  24. assert msgs[1].line == 21