Made all unittests pass again.

This commit is contained in:
Griatch 2016-02-14 08:47:06 +01:00
parent 323a353ec3
commit 83570848d6
4 changed files with 4 additions and 4 deletions

View file

@ -68,7 +68,7 @@ class CommandTest(EvenniaTest):
cmdobj.func()
cmdobj.at_post_cmd()
# clean out prettytable sugar
stored_msg = [args[0] for name, args, kwargs in receiver.msg.mock_calls]
stored_msg = [args[0] if args else kwargs.get("text",kwargs) for name, args, kwargs in receiver.msg.mock_calls]
returned_msg = "||".join(_RE.sub("", mess) for mess in stored_msg)
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
if msg is not None:

View file

@ -625,7 +625,6 @@ class ServerSessionHandler(SessionHandler):
if session:
for cmdname, (cmdargs, cmdkwargs) in kwargs.iteritems():
cname = cmdname.strip().lower()
print "sessionhandler.data_in:", session, kwargs
try:
if cname in _INPUT_FUNCS:
_INPUT_FUNCS[cname](session, *cmdargs, **cmdkwargs)

View file

@ -425,7 +425,7 @@ class EvForm(object):
return unicode(ANSIString("\n").join([line for line in self.form]))
def _test():
"test evform"
"test evform. This is used by the unittest system."
form = EvForm("evennia.utils.evform_test")
# add data to each tagged form cell
@ -449,7 +449,6 @@ def _test():
# add the tables to the proper ids in the form
form.map(tables={"A": tableA,
"B": tableB})
# unicode is required since the example contains non-ascii characters
#print(unicode(form))
return form

View file

@ -348,8 +348,10 @@ from evennia.utils import evform
class TestEvForm(TestCase):
def test_form(self):
self.maxDiff = None
self.assertEqual(unicode(evform._test()),
u'.------------------------------------------------.\n| |\n| Name: \x1b[1m\x1b[32mTom\x1b[1m\x1b[32m \x1b[1m\x1b[32mthe\x1b[1m\x1b[32m \x1b[0m Player: \x1b[1m\x1b[33mGriatch\x1b[0m \x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[1m\x1b[32m\x1b[0m |\n| \x1b[1m\x1b[32mBouncer\x1b[0m\x1b[0m |\n| |\n >----------------------------------------------<\n| |\n| Desc: A sturdy \x1b[0m STR: 12 \x1b[0m DEX: 10 \x1b[0m |\n| fellow\x1b[0m INT: 5 \x1b[0m STA: 18 \x1b[0m |\n| LUC: 10 MAG: 3 |\n| |\n >----------------------------------------------<\n| | |\n| HP|MV |M\x1b[0m | Skill |Value |Exp \x1b[0m |\n| ~~+~~~+~ | ~~~~~~~~~~~~+~~~~~~~~~~+~~~~~~~~~~~ |\n| **|***\x1b[0m|*\x1b[0m | Shooting |12 |550/1200 \x1b[0m\x1b[0m |\n| |**\x1b[0m |*\x1b[0m | Herbalism |14 |990/1400 \x1b[0m\x1b[0m |\n| | |*\x1b[0m | Smithing |9 |205/900 \x1b[0m |\n| | |\n ------------------------------------------------\n')
def test_ansi_escape(self):
# note that in a msg() call, the result would be the correct |-----,
# in a print, ansi only gets called once, so ||----- is the result