Made all unittests pass again.
This commit is contained in:
parent
323a353ec3
commit
83570848d6
4 changed files with 4 additions and 4 deletions
|
|
@ -68,7 +68,7 @@ class CommandTest(EvenniaTest):
|
||||||
cmdobj.func()
|
cmdobj.func()
|
||||||
cmdobj.at_post_cmd()
|
cmdobj.at_post_cmd()
|
||||||
# clean out prettytable sugar
|
# 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 = "||".join(_RE.sub("", mess) for mess in stored_msg)
|
||||||
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
|
returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip()
|
||||||
if msg is not None:
|
if msg is not None:
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,6 @@ class ServerSessionHandler(SessionHandler):
|
||||||
if session:
|
if session:
|
||||||
for cmdname, (cmdargs, cmdkwargs) in kwargs.iteritems():
|
for cmdname, (cmdargs, cmdkwargs) in kwargs.iteritems():
|
||||||
cname = cmdname.strip().lower()
|
cname = cmdname.strip().lower()
|
||||||
print "sessionhandler.data_in:", session, kwargs
|
|
||||||
try:
|
try:
|
||||||
if cname in _INPUT_FUNCS:
|
if cname in _INPUT_FUNCS:
|
||||||
_INPUT_FUNCS[cname](session, *cmdargs, **cmdkwargs)
|
_INPUT_FUNCS[cname](session, *cmdargs, **cmdkwargs)
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ class EvForm(object):
|
||||||
return unicode(ANSIString("\n").join([line for line in self.form]))
|
return unicode(ANSIString("\n").join([line for line in self.form]))
|
||||||
|
|
||||||
def _test():
|
def _test():
|
||||||
"test evform"
|
"test evform. This is used by the unittest system."
|
||||||
form = EvForm("evennia.utils.evform_test")
|
form = EvForm("evennia.utils.evform_test")
|
||||||
|
|
||||||
# add data to each tagged form cell
|
# add data to each tagged form cell
|
||||||
|
|
@ -449,7 +449,6 @@ def _test():
|
||||||
# add the tables to the proper ids in the form
|
# add the tables to the proper ids in the form
|
||||||
form.map(tables={"A": tableA,
|
form.map(tables={"A": tableA,
|
||||||
"B": tableB})
|
"B": tableB})
|
||||||
|
|
||||||
# unicode is required since the example contains non-ascii characters
|
# unicode is required since the example contains non-ascii characters
|
||||||
#print(unicode(form))
|
#print(unicode(form))
|
||||||
return form
|
return form
|
||||||
|
|
|
||||||
|
|
@ -348,8 +348,10 @@ from evennia.utils import evform
|
||||||
|
|
||||||
class TestEvForm(TestCase):
|
class TestEvForm(TestCase):
|
||||||
def test_form(self):
|
def test_form(self):
|
||||||
|
self.maxDiff = None
|
||||||
self.assertEqual(unicode(evform._test()),
|
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')
|
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):
|
def test_ansi_escape(self):
|
||||||
# note that in a msg() call, the result would be the correct |-----,
|
# note that in a msg() call, the result would be the correct |-----,
|
||||||
# in a print, ansi only gets called once, so ||----- is the result
|
# in a print, ansi only gets called once, so ||----- is the result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue