paths_test.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2016 YouCompleteMe contributors
  2. #
  3. # This file is part of YouCompleteMe.
  4. #
  5. # YouCompleteMe is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # YouCompleteMe is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
  17. from ycm.test_utils import MockVimModule
  18. MockVimModule()
  19. from nose.tools import ok_
  20. from ycm.paths import EndsWithPython
  21. def EndsWithPython_Python2Paths_test():
  22. python_paths = [
  23. 'python',
  24. '/usr/bin/python2.6',
  25. '/home/user/.pyenv/shims/python2.7',
  26. r'C:\Python26\python.exe'
  27. ]
  28. for path in python_paths:
  29. ok_( EndsWithPython( path ) )
  30. def EndsWithPython_NotPython2Paths_test():
  31. not_python_paths = [
  32. '/opt/local/bin/vim',
  33. r'C:\Program Files\Vim\vim74\gvim.exe',
  34. '/usr/bin/python3',
  35. '/home/user/.pyenv/shims/python3',
  36. ]
  37. for path in not_python_paths:
  38. ok_( not EndsWithPython( path ) )