diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index a0492d6aab..a3be98984a 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -94,8 +94,11 @@ class CommandTest(EvenniaTest): # Get the first element of a tuple if msg received a tuple instead of a string stored_msg = [smsg[0] if isinstance(smsg, tuple) else smsg for smsg in stored_msg] if msg is not None: - returned_msg = "||".join(_RE.sub("", mess) for mess in stored_msg) - returned_msg = ansi.parse_ansi(returned_msg, strip_ansi=noansi).strip() + # set our separator for returned messages based on parsing ansi or not + msg_sep = "|" if noansi else "||" + # Have to strip ansi for each returned message for the regex to handle it correctly + returned_msg = msg_sep.join(_RE.sub("", ansi.parse_ansi(mess, strip_ansi=noansi)) + for mess in stored_msg).strip() if msg == "" and returned_msg or not returned_msg.startswith(msg.strip()): sep1 = "\n" + "=" * 30 + "Wanted message" + "=" * 34 + "\n" sep2 = "\n" + "=" * 30 + "Returned message" + "=" * 32 + "\n" @@ -166,7 +169,7 @@ class TestSystem(CommandTest): self.call(system.CmdPy(), "1+2", ">>> 1+2|3") def test_scripts(self): - self.call(system.CmdScripts(), "", "| dbref |") + self.call(system.CmdScripts(), "", "dbref ") def test_objects(self): self.call(system.CmdObjects(), "", "Object subtype totals") diff --git a/evennia/contrib/tests.py b/evennia/contrib/tests.py index 78ecc0f4fb..233327a264 100644 --- a/evennia/contrib/tests.py +++ b/evennia/contrib/tests.py @@ -688,8 +688,8 @@ class TestMail(CommandTest): "You have received a new @mail from TestAccount2(account 2)|You sent your message.", caller=self.account2) self.call(mail.CmdMail(), "TestAccount=Message 1", "You sent your message.", caller=self.account2) self.call(mail.CmdMail(), "TestAccount=Message 2", "You sent your message.", caller=self.account2) - self.call(mail.CmdMail(), "", "------------------------------------------------------------------------------| ID: From: Subject:", caller=self.account) - self.call(mail.CmdMail(), "2", "------------------------------------------------------------------------------\nFrom: TestAccount2", caller=self.account) + self.call(mail.CmdMail(), "", "| ID: From: Subject:", caller=self.account) + self.call(mail.CmdMail(), "2", "From: TestAccount2", caller=self.account) self.call(mail.CmdMail(), "/forward TestAccount2 = 1/Forward message", "You sent your message.|Message forwarded.", caller=self.account) self.call(mail.CmdMail(), "/reply 2=Reply Message2", "You sent your message.", caller=self.account) self.call(mail.CmdMail(), "/delete 2", "Message 2 deleted", caller=self.account)