xonsh/tests/test_wizard.py
2016-01-02 02:15:37 -08:00

36 lines
901 B
Python

# -*- coding: utf-8 -*-
"""Tests the xonsh lexer."""
from __future__ import unicode_literals, print_function
import os
import nose
from nose.tools import assert_equal, assert_true, assert_false
from xonsh.wizard import (Node, Wizard, Pass, PrettyFormatter,
Message, Question)
TREE0 = Wizard(children=[Pass(), Message(message='yo')])
TREE1 = Question('wakka?', {'jawaka': Pass()})
def test_pretty_format_tree0():
exp = ('Wizard(children=[\n'
' Pass(),\n'
" Message('yo')\n"
'])')
obs = PrettyFormatter(TREE0).visit()
assert_equal(exp, obs)
def test_pretty_format_tree1():
exp = ('Question(\n'
" question='wakka?',\n"
' responses={\n'
" 'jawaka': Pass()\n"
' }\n'
')')
obs = PrettyFormatter(TREE1).visit()
assert_equal(exp, obs)
if __name__ == '__main__':
nose.runmodule()