From: Jeremy Stanley Date: Sat, 11 May 2019 13:18:04 +0000 (+0000) Subject: Correct a TypeError in the show time command X-Git-Tag: 0.0.1~16 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=2f395c0d81aa9ca60a86940dcb4c49c9f7e5815d;p=mudpy.git Correct a TypeError in the show time command Add missing type conversion in the output of the show time administrative command, and include a regression test so we assure it continues to work. --- diff --git a/mudpy/command.py b/mudpy/command.py index a26906b..5ba3d28 100644 --- a/mudpy/command.py +++ b/mudpy/command.py @@ -423,9 +423,8 @@ def show(actor, parameters): elif arguments[0] == "version": message = repr(actor.universe.versions) elif arguments[0] == "time": - message = actor.universe.groups["internal"]["counters"].get( - "elapsed" - ) + " increments elapsed since the world was created." + message = "%s increments elapsed since the world was created." % ( + str(actor.universe.groups["internal"]["counters"].get("elapsed"))) elif arguments[0] == "groups": message = "These are the element groups:$(eol)" groups = list(actor.universe.groups.keys()) diff --git a/mudpy/tests/selftest.py b/mudpy/tests/selftest.py index 520f2fd..497d970 100644 --- a/mudpy/tests/selftest.py +++ b/mudpy/tests/selftest.py @@ -245,6 +245,11 @@ test_show_version = ( (2, r"Running mudpy .* on .* Python 3.*with.*pyyaml.*> ", ""), ) +test_show_time = ( + (2, "> ", "show time"), + (2, r"\r\n[0-9]+ increments elapsed.*> ", ""), +) + test_show_files = ( (2, "> ", "show files"), (2, r'These are the current files containing the universe:.*' @@ -345,6 +350,7 @@ dialogue = ( (test_set_facet, "set facet"), (test_set_refused, "refuse altering read-only element"), (test_show_version, "show version and diagnostic info"), + (test_show_time, "show elapsed world clock increments"), (test_show_files, "show a list of loaded files"), (test_show_file, "show nodes from a specific file"), (test_show_groups, "show groups"),