paths_test.py 1.3 KB

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