xonsh/tests/test_prompt_toolkit_tools.py
Kurtis Rader e88c863d10 Add a uniform character encoding to all files.
I wouldn't normally do something like this but issue #487 brought to
my attention the fact that too many of the python modules don't have
an encoding comment and of those that do there is a lot of pointless
inconsistency in the style of the comment.
2015-11-16 14:10:40 -08:00

25 lines
828 B
Python

# -*- coding: utf-8 -*-
"""Tests some tools function for prompt_toolkit integration."""
from __future__ import unicode_literals, print_function
import nose
from nose.tools import assert_equal
from xonsh.tools import format_prompt_for_prompt_toolkit
from xonsh.tools import TERM_COLORS
from xonsh.environ import format_prompt
def test_format_prompt_for_prompt_toolkit():
templ = ('>>> {BOLD_BLUE}~/xonsh {WHITE} (main){NO_COLOR}')
prompt = format_prompt(templ, TERM_COLORS)
token_names, color_styles, strings = format_prompt_for_prompt_toolkit(prompt)
assert_equal(token_names, ['NO_COLOR', 'BOLD_BLUE', 'WHITE', 'NO_COLOR'])
assert_equal(color_styles, ['', 'bold #0000FF', '#FFFFFF', ''])
assert_equal(strings, ['>>> ', '~/xonsh ', ' (main)', ''])
if __name__ == '__main__':
nose.runmodule()