Syntax highlighting

This commit is contained in:
Anthony Sottile
2020-02-22 16:34:47 -08:00
parent 1d06a77d44
commit 697b012027
29 changed files with 2515 additions and 18 deletions

20
tests/user_data_test.py Normal file
View File

@@ -0,0 +1,20 @@
import os
from unittest import mock
from babi.user_data import xdg_data
def test_when_xdg_data_home_is_set():
with mock.patch.dict(os.environ, {'XDG_DATA_HOME': '/foo'}):
ret = xdg_data('history', 'command')
assert ret == '/foo/babi/history/command'
def test_when_xdg_data_home_is_not_set():
def fake_expanduser(s):
return s.replace('~', '/home/username')
with mock.patch.object(os.path, 'expanduser', fake_expanduser):
with mock.patch.dict(os.environ, clear=True):
ret = xdg_data('history')
assert ret == '/home/username/.local/share/babi/history'