Merge pull request #1163 from scop/diff-screen-enter
[git-cola.git] / test / display_test.py
blob8a41f39b37d64aa52b55bb13547cc87e31143427
1 from __future__ import absolute_import, division, print_function, unicode_literals
3 from cola import display
6 def test_shorten_paths():
7 paths = (
8 '/usr/src/git-cola/src',
9 '/usr/src/example/src',
10 '/usr/src/super/lib/src',
11 '/usr/src/super/tools/src',
12 '/usr/src/super/example/src',
13 '/lib/src',
15 actual = display.shorten_paths(paths)
16 assert actual[paths[0]] == 'git-cola/src'
17 assert actual[paths[1]] == 'src/example/src'
18 assert actual[paths[2]] == 'super/lib/src'
19 assert actual[paths[3]] == 'tools/src'
20 assert actual[paths[4]] == 'super/example/src'
21 assert actual[paths[5]] == '/lib/src'
24 def test_normalize_path():
25 path = r'C:\games\doom2'
26 expect = 'C:/games/doom2'
27 actual = display.normalize_path(path)
28 assert expect == actual