Updated HTML docs

This commit is contained in:
Griatch 2022-01-21 00:21:02 +01:00
parent 7c06220c24
commit 3aaf366163
89 changed files with 1540 additions and 1583 deletions

View file

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 558d7a9fd456e0fe1612db3fefcd5999
config: 3ae78794af4a3623a9fc74fd3022f6da
tags: 645f666f9bcd5a90fca523b33c5a78b7

View file

@ -54,8 +54,6 @@
<span class="sd"> &gt; python game/manage.py test.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">types</span>
<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">from</span> <span class="nn">anything</span> <span class="kn">import</span> <span class="n">Anything</span>
@ -66,7 +64,7 @@
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultRoom</span><span class="p">,</span> <span class="n">DefaultExit</span><span class="p">,</span> <span class="n">ObjectDB</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.cmdset_character</span> <span class="kn">import</span> <span class="n">CharacterCmdSet</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">EvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">BaseEvenniaCommandTest</span><span class="p">,</span> <span class="n">EvenniaCommandTest</span> <span class="c1"># noqa</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">help</span> <span class="k">as</span> <span class="n">help_module</span><span class="p">,</span>
<span class="n">general</span><span class="p">,</span>
@ -83,305 +81,18 @@
<span class="kn">from</span> <span class="nn">evennia.commands.command</span> <span class="kn">import</span> <span class="n">Command</span><span class="p">,</span> <span class="n">InterruptCommand</span>
<span class="kn">from</span> <span class="nn">evennia.commands</span> <span class="kn">import</span> <span class="n">cmdparser</span>
<span class="kn">from</span> <span class="nn">evennia.commands.cmdset</span> <span class="kn">import</span> <span class="n">CmdSet</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">ansi</span><span class="p">,</span> <span class="n">utils</span><span class="p">,</span> <span class="n">gametime</span><span class="p">,</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">utils</span><span class="p">,</span> <span class="n">gametime</span><span class="p">,</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.server.sessionhandler</span> <span class="kn">import</span> <span class="n">SESSIONS</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">search_object</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultObject</span><span class="p">,</span> <span class="n">DefaultCharacter</span>
<span class="kn">from</span> <span class="nn">evennia.prototypes</span> <span class="kn">import</span> <span class="n">prototypes</span> <span class="k">as</span> <span class="n">protlib</span>
<span class="c1"># set up signal here since we are not starting the server</span>
<span class="n">_RE_STRIP_EVMENU</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^\+|-+\+|\+-+|--+|\|(?:\s|$)&quot;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">MULTILINE</span><span class="p">)</span>
<span class="c1"># ------------------------------------------------------------</span>
<span class="c1"># Command testing</span>
<span class="c1"># ------------------------------------------------------------</span>
<div class="viewcode-block" id="CommandTestMixin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.server.portal.portal.LoopingCall&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">MagicMock</span><span class="p">())</span>
<span class="k">class</span> <span class="nc">CommandTestMixin</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Mixin to add to a test in order to provide the `.call` helper for</span>
<span class="sd"> testing the execution and returns of a command.</span>
<span class="sd"> Tests a Command by running it and comparing what messages it sends with</span>
<span class="sd"> expected values. This tests without actually spinning up the cmdhandler</span>
<span class="sd"> for every test, which is more controlled.</span>
<span class="sd"> Example:</span>
<span class="sd"> ::</span>
<span class="sd"> from commands.echo import CmdEcho</span>
<span class="sd"> class MyCommandTest(EvenniaTest, CommandTestMixin):</span>
<span class="sd"> def test_echo(self):</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> self.call(MyCommand(), &quot;hello world!&quot;,</span>
<span class="sd"> &quot;You hear your echo: &#39;Hello world!&#39;&quot;)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># formatting for .call&#39;s error message</span>
<span class="n">_ERROR_FORMAT</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="s2">=========================== Wanted message ===================================</span>
<span class="si">{expected_msg}</span><span class="s2"></span>
<span class="s2">=========================== Returned message =================================</span>
<span class="si">{returned_msg}</span><span class="s2"></span>
<span class="s2">==============================================================================</span>
<span class="s2">&quot;&quot;&quot;</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
<div class="viewcode-block" id="CommandTestMixin.call"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin.call">[docs]</a> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">cmdobj</span><span class="p">,</span>
<span class="n">input_args</span><span class="p">,</span>
<span class="n">msg</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdset</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">noansi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">caller</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">receiver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdstring</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">obj</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">inputs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">raw_string</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test a command by assigning all the needed properties to a cmdobj and</span>
<span class="sd"> running the sequence. The resulting `.msg` calls will be mocked and</span>
<span class="sd"> the text= calls to them compared to a expected output.</span>
<span class="sd"> Args:</span>
<span class="sd"> cmdobj (Command): The command object to use.</span>
<span class="sd"> input_args (str): This should be the full input the Command should</span>
<span class="sd"> see, such as &#39;look here&#39;. This will become `.args` for the Command</span>
<span class="sd"> instance to parse.</span>
<span class="sd"> msg (str or dict, optional): This is the expected return value(s)</span>
<span class="sd"> returned through `caller.msg(text=...)` calls in the command. If a string, the</span>
<span class="sd"> receiver is controlled with the `receiver` kwarg (defaults to `caller`).</span>
<span class="sd"> If this is a `dict`, it is a mapping</span>
<span class="sd"> `{receiver1: &quot;expected1&quot;, receiver2: &quot;expected2&quot;,...}` and `receiver` is</span>
<span class="sd"> ignored. The message(s) are compared with the actual messages returned</span>
<span class="sd"> to the receiver(s) as the Command runs. Each check uses `.startswith`,</span>
<span class="sd"> so you can choose to only include the first part of the</span>
<span class="sd"> returned message if that&#39;s enough to verify a correct result. EvMenu</span>
<span class="sd"> decorations (like borders) are stripped and should not be included. This</span>
<span class="sd"> should also not include color tags unless `noansi=False`.</span>
<span class="sd"> If the command returns texts in multiple separate `.msg`-</span>
<span class="sd"> calls to a receiver, separate these with `|` if `noansi=True`</span>
<span class="sd"> (default) and `||` if `noansi=False`. If no `msg` is given (`None`),</span>
<span class="sd"> then no automatic comparison will be done.</span>
<span class="sd"> cmdset (str, optional): If given, make `.cmdset` available on the Command</span>
<span class="sd"> instance as it runs. While `.cmdset` is normally available on the</span>
<span class="sd"> Command instance by default, this is usually only used by</span>
<span class="sd"> commands that explicitly operates/displays cmdsets, like</span>
<span class="sd"> `examine`.</span>
<span class="sd"> noansi (str, optional): By default the color tags of the `msg` is</span>
<span class="sd"> ignored, this makes them significant. If unset, `msg` must contain</span>
<span class="sd"> the same color tags as the actual return message.</span>
<span class="sd"> caller (Object or Account, optional): By default `self.char1` is used as the</span>
<span class="sd"> command-caller (the `.caller` property on the Command). This allows to</span>
<span class="sd"> execute with another caller, most commonly an Account.</span>
<span class="sd"> receiver (Object or Account, optional): This is the object to receive the</span>
<span class="sd"> return messages we want to test. By default this is the same as `caller`</span>
<span class="sd"> (which in turn defaults to is `self.char1`). Note that if `msg` is</span>
<span class="sd"> a `dict`, this is ignored since the receiver is already specified there.</span>
<span class="sd"> cmdstring (str, optional): Normally this is the Command&#39;s `key`.</span>
<span class="sd"> This allows for tweaking the `.cmdname` property of the</span>
<span class="sd"> Command`. This isb used for commands with multiple aliases,</span>
<span class="sd"> where the command explicitly checs which alias was used to</span>
<span class="sd"> determine its functionality.</span>
<span class="sd"> obj (str, optional): This sets the `.obj` property of the Command - the</span>
<span class="sd"> object on which the Command &#39;sits&#39;. By default this is the same as `caller`.</span>
<span class="sd"> This can be used for testing on-object Command interactions.</span>
<span class="sd"> inputs (list, optional): A list of strings to pass to functions that pause to</span>
<span class="sd"> take input from the user (normally using `@interactive` and</span>
<span class="sd"> `ret = yield(question)` or `evmenu.get_input`). Each element of the</span>
<span class="sd"> list will be passed into the command as if the user wrote that at the prompt.</span>
<span class="sd"> raw_string (str, optional): Normally the `.raw_string` property is set as</span>
<span class="sd"> a combination of your `key/cmdname` and `input_args`. This allows</span>
<span class="sd"> direct control of what this is, for example for testing edge cases</span>
<span class="sd"> or malformed inputs.</span>
<span class="sd"> Returns:</span>
<span class="sd"> str or dict: The message sent to `receiver`, or a dict of</span>
<span class="sd"> `{receiver: &quot;msg&quot;, ...}` if multiple are given. This is usually</span>
<span class="sd"> only used with `msg=None` to do the validation externally.</span>
<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If the returns of `.msg` calls (tested with `.startswith`) does not</span>
<span class="sd"> match `expected_input`.</span>
<span class="sd"> Notes:</span>
<span class="sd"> As part of the tests, all methods of the Command will be called in</span>
<span class="sd"> the proper order:</span>
<span class="sd"> - cmdobj.at_pre_cmd()</span>
<span class="sd"> - cmdobj.parse()</span>
<span class="sd"> - cmdobj.func()</span>
<span class="sd"> - cmdobj.at_post_cmd()</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># The `self.char1` is created in the `EvenniaTest` base along with</span>
<span class="c1"># other helper objects like self.room and self.obj</span>
<span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="o">=</span> <span class="n">cmdstring</span> <span class="k">if</span> <span class="n">cmdstring</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_cmdname</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdstring</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="c1"># deprecated</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdset</span> <span class="o">=</span> <span class="n">cmdset</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">SESSIONS</span><span class="o">.</span><span class="n">session_from_sessid</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">account</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">account</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_string</span> <span class="o">=</span> <span class="n">raw_string</span> <span class="k">if</span> <span class="n">raw_string</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> <span class="ow">or</span> <span class="p">(</span><span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">)</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="n">inputs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="c1"># set up receivers</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="c1"># a mapping {receiver: msg, ...}</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">recv</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">recv</span><span class="p">,</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">msg</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># a single expected string and thus a single receiver (defaults to caller)</span>
<span class="n">receiver</span> <span class="o">=</span> <span class="n">receiver</span> <span class="k">if</span> <span class="n">receiver</span> <span class="k">else</span> <span class="n">caller</span>
<span class="n">receiver_mapping</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">unmocked_msg_methods</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="p">:</span>
<span class="c1"># save the old .msg method so we can get it back</span>
<span class="c1"># cleanly after the test</span>
<span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span>
<span class="c1"># replace normal `.msg` with a mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="c1"># Run the methods of the Command. This mimics what happens in the</span>
<span class="c1"># cmdhandler. This will have the mocked .msg be called as part of the</span>
<span class="c1"># execution. Mocks remembers what was sent to them so we will be able</span>
<span class="c1"># to retrieve what was sent later.</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">at_pre_cmd</span><span class="p">():</span>
<span class="k">return</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">parse</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
<span class="c1"># handle func&#39;s with yield in them (making them generators)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">GeneratorType</span><span class="p">):</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">inp</span> <span class="o">=</span> <span class="n">inputs</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="k">if</span> <span class="n">inputs</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">if</span> <span class="n">inp</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># this mimics a user&#39;s reply to a prompt</span>
<span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># non-input yield, like yield(10). We don&#39;t pause</span>
<span class="c1"># but fire it immediately.</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">at_post_cmd</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">except</span> <span class="n">InterruptCommand</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">for</span> <span class="n">inp</span> <span class="ow">in</span> <span class="n">inputs</span><span class="p">:</span>
<span class="c1"># if there are any inputs left, we may have a non-generator</span>
<span class="c1"># input to handle (get_input/ask_yes_no that uses a separate</span>
<span class="c1"># cmdset rather than a yield</span>
<span class="n">caller</span><span class="o">.</span><span class="n">execute_cmd</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="c1"># At this point the mocked .msg methods on each receiver will have</span>
<span class="c1"># stored all calls made to them (that&#39;s a basic function of the Mock</span>
<span class="c1"># class). We will not extract them and compare to what we expected to</span>
<span class="c1"># go to each receiver.</span>
<span class="n">returned_msgs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span><span class="p">,</span> <span class="n">expected_msg</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="c1"># get the stored messages from the Mock with Mock.mock_calls.</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">else</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">,</span> <span class="n">utils</span><span class="o">.</span><span class="n">to_str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">))</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span> <span class="ow">in</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span><span class="o">.</span><span class="n">mock_calls</span>
<span class="p">]</span>
<span class="c1"># we can return this now, we are done using the mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span>
<span class="c1"># Get the first element of a tuple if msg received a tuple instead of a string</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">smsg</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)</span> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">)</span> <span class="k">for</span> <span class="n">smsg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">]</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># no expected_msg; just build the returned_msgs dict</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">returned_msg</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># compare messages to expected</span>
<span class="c1"># set our separator for returned messages based on parsing ansi or not</span>
<span class="n">msg_sep</span> <span class="o">=</span> <span class="s2">&quot;|&quot;</span> <span class="k">if</span> <span class="n">noansi</span> <span class="k">else</span> <span class="s2">&quot;||&quot;</span>
<span class="c1"># We remove Evmenu decorations since that just makes it harder</span>
<span class="c1"># to write the comparison string. We also strip ansi before this</span>
<span class="c1"># comparison since otherwise it would mess with the regex.</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="n">msg_sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
<span class="n">_RE_STRIP_EVMENU</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span>
<span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">mess</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">))</span>
<span class="k">for</span> <span class="n">mess</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="c1"># this is the actual test</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="ow">and</span> <span class="n">returned_msg</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">returned_msg</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">expected_msg</span><span class="p">):</span>
<span class="c1"># failed the test</span>
<span class="k">raise</span> <span class="ne">AssertionError</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ERROR_FORMAT</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">expected_msg</span><span class="o">=</span><span class="n">expected_msg</span><span class="p">,</span> <span class="n">returned_msg</span><span class="o">=</span><span class="n">returned_msg</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># passed!</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">returned_msg</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">returned_msgs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">returned_msgs</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">return</span> <span class="n">returned_msgs</span></div></div>
<div class="viewcode-block" id="EvenniaCommandTest"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.account.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.admin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.batchprocess.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.building.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.comms.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.general.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.help.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.syscommands.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.system.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.unloggedin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">EvenniaCommandTest</span><span class="p">(</span><span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Commands only using the default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="CommandTest"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTest">[docs]</a><span class="k">class</span> <span class="nc">CommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parent class to inherit from - makes tests use your own</span>
<span class="sd"> classes and settings in mygame.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<span class="c1"># ------------------------------------------------------------</span>
<span class="c1"># Individual module Tests</span>
<span class="c1"># ------------------------------------------------------------</span>
<div class="viewcode-block" id="TestGeneral"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral">[docs]</a><span class="k">class</span> <span class="nc">TestGeneral</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGeneral"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral">[docs]</a><span class="k">class</span> <span class="nc">TestGeneral</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGeneral.test_look"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral.test_look">[docs]</a> <span class="k">def</span> <span class="nf">test_look</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">rid</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="o">.</span><span class="n">id</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdLook</span><span class="p">(),</span> <span class="s2">&quot;here&quot;</span><span class="p">,</span> <span class="s2">&quot;Room(#</span><span class="si">{}</span><span class="s2">)</span><span class="se">\n</span><span class="s2">room_desc&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">rid</span><span class="p">))</span></div>
@ -477,7 +188,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdAccess</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Permission Hierarchy (climbing):&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestHelp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestHelp">[docs]</a><span class="k">class</span> <span class="nc">TestHelp</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestHelp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestHelp">[docs]</a><span class="k">class</span> <span class="nc">TestHelp</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="n">maxDiff</span> <span class="o">=</span> <span class="kc">None</span>
@ -627,7 +338,7 @@
<span class="n">cmdset</span><span class="o">=</span><span class="n">TestCmdSet</span><span class="p">())</span></div>
<div class="viewcode-block" id="TestSystem"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem">[docs]</a><span class="k">class</span> <span class="nc">TestSystem</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystem"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem">[docs]</a><span class="k">class</span> <span class="nc">TestSystem</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystem.test_py"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem.test_py">[docs]</a> <span class="k">def</span> <span class="nf">test_py</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># we are not testing CmdReload, CmdReset and CmdShutdown, CmdService or CmdTime</span>
<span class="c1"># since the server is not running during these tests.</span>
@ -651,7 +362,7 @@
<div class="viewcode-block" id="func_test_cmd_tasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.func_test_cmd_tasks">[docs]</a><span class="k">def</span> <span class="nf">func_test_cmd_tasks</span><span class="p">():</span>
<span class="k">return</span> <span class="s1">&#39;success&#39;</span></div>
<div class="viewcode-block" id="TestCmdTasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks">[docs]</a><span class="k">class</span> <span class="nc">TestCmdTasks</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestCmdTasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks">[docs]</a><span class="k">class</span> <span class="nc">TestCmdTasks</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestCmdTasks.setUp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
@ -811,7 +522,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">CmdTasks</span><span class="p">(),</span> <span class="sa">f</span><span class="s1">&#39;/cancel&#39;</span><span class="p">,</span> <span class="n">wanted_msg</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestAdmin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin">[docs]</a><span class="k">class</span> <span class="nc">TestAdmin</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAdmin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin">[docs]</a><span class="k">class</span> <span class="nc">TestAdmin</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAdmin.test_emit"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin.test_emit">[docs]</a> <span class="k">def</span> <span class="nf">test_emit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">admin</span><span class="o">.</span><span class="n">CmdEmit</span><span class="p">(),</span> <span class="s2">&quot;Char2 = Test&quot;</span><span class="p">,</span> <span class="s2">&quot;Emitted to Char2:</span><span class="se">\n</span><span class="s2">Test&quot;</span><span class="p">)</span></div>
@ -842,7 +553,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestAccount"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount">[docs]</a><span class="k">class</span> <span class="nc">TestAccount</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAccount"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount">[docs]</a><span class="k">class</span> <span class="nc">TestAccount</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAccount.test_ooc_look"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount.test_ooc_look">[docs]</a> <span class="k">def</span> <span class="nf">test_ooc_look</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">MULTISESSION_MODE</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -966,7 +677,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestBuilding"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding">[docs]</a><span class="k">class</span> <span class="nc">TestBuilding</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuilding"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding">[docs]</a><span class="k">class</span> <span class="nc">TestBuilding</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuilding.test_create"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding.test_create">[docs]</a> <span class="k">def</span> <span class="nf">test_create</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_OBJECT_TYPECLASS</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -2034,7 +1745,7 @@
<div class="viewcode-block" id="TestCommsChannel"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCommsChannel">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.default.comms.CHANNEL_DEFAULT_TYPECLASS&quot;</span><span class="p">,</span> <span class="n">DefaultChannel</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">TestCommsChannel</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TestCommsChannel</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test the central `channel` command.</span>
@ -2257,7 +1968,7 @@
<span class="kn">from</span> <span class="nn">evennia.commands.default</span> <span class="kn">import</span> <span class="n">comms</span> <span class="c1"># noqa</span>
<div class="viewcode-block" id="TestComms"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms">[docs]</a><span class="k">class</span> <span class="nc">TestComms</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestComms"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms">[docs]</a><span class="k">class</span> <span class="nc">TestComms</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestComms.test_page"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms.test_page">[docs]</a> <span class="k">def</span> <span class="nf">test_page</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -2269,7 +1980,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestBatchProcess"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBatchProcess">[docs]</a><span class="k">class</span> <span class="nc">TestBatchProcess</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBatchProcess"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBatchProcess">[docs]</a><span class="k">class</span> <span class="nc">TestBatchProcess</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test the batch processor.</span>
@ -2305,13 +2016,13 @@
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">&quot;in func&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestInterruptCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand">[docs]</a><span class="k">class</span> <span class="nc">TestInterruptCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestInterruptCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand">[docs]</a><span class="k">class</span> <span class="nc">TestInterruptCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestInterruptCommand.test_interrupt_command"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command">[docs]</a> <span class="k">def</span> <span class="nf">test_interrupt_command</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">ret</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">CmdInterrupt</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestUnconnectedCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnconnectedCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnconnectedCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnconnectedCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnconnectedCommand.test_info_command"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand.test_info_command">[docs]</a> <span class="k">def</span> <span class="nf">test_info_command</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># instead of using SERVER_START_TIME (0), we use 86400 because Windows won&#39;t let us use anything lower</span>
<span class="n">gametime</span><span class="o">.</span><span class="n">SERVER_START_TIME</span> <span class="o">=</span> <span class="mi">86400</span>
@ -2331,7 +2042,7 @@
<span class="c1"># Test syscommands</span>
<div class="viewcode-block" id="TestSystemCommands"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestSystemCommands</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystemCommands"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestSystemCommands</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystemCommands.test_simple_defaults"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands.test_simple_defaults">[docs]</a> <span class="k">def</span> <span class="nf">test_simple_defaults</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">syscommands</span><span class="o">.</span><span class="n">SystemNoInput</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">syscommands</span><span class="o">.</span><span class="n">SystemNoMatch</span><span class="p">(),</span> <span class="s2">&quot;Huh?&quot;</span><span class="p">)</span></div>

View file

@ -719,19 +719,25 @@
<span class="n">location</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">location</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="n">destination</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">destination</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">if</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">home</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">nohome</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">home</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">except</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">:</span>
<span class="k">if</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="n">home</span>
<span class="k">elif</span> <span class="n">nohome</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">home_obj_or_dbref</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">except</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">:</span>
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">_TEST_ENVIRONMENT</span><span class="p">:</span>
<span class="c1"># this happens for databases where the #1 location is flushed during tests</span>
<span class="n">home</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">(</span>
<span class="s2">&quot;settings.DEFAULT_HOME (= &#39;</span><span class="si">%s</span><span class="s2">&#39;) does not exist, or the setting is malformed.&quot;</span>
<span class="o">%</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span>
<span class="sa">f</span><span class="s2">&quot;settings.DEFAULT_HOME (= &#39;</span><span class="si">{</span><span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span><span class="si">}</span><span class="s2">&#39;) does not exist, &quot;</span>
<span class="s2">&quot;or the setting is malformed.&quot;</span>
<span class="p">)</span>
<span class="k">elif</span> <span class="n">nohome</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="kc">None</span>
<span class="c1"># create new instance</span>
<span class="n">new_object</span> <span class="o">=</span> <span class="n">typeclass</span><span class="p">(</span>

View file

@ -44,12 +44,34 @@
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Various helper resources for writing unittests.</span>
<span class="sd">Classes for testing Evennia core:</span>
<span class="sd">- `BaseEvenniaTestCase` - no default objects, only enforced default settings</span>
<span class="sd">- `BaseEvenniaTest` - all default objects, enforced default settings</span>
<span class="sd">- `BaseEvenniaCommandTest` - for testing Commands, enforced default settings</span>
<span class="sd">Classes for testing game folder content:</span>
<span class="sd">- `EvenniaTestCase` - no default objects, using gamedir settings (identical to</span>
<span class="sd"> standard Python TestCase)</span>
<span class="sd">- `EvenniaTest` - all default objects, using gamedir settings</span>
<span class="sd">- `EvenniaCommandTest` - for testing game folder commands, using gamedir settings</span>
<span class="sd">Other:</span>
<span class="sd">- `EvenniaTestMixin` - A class mixin for creating the test environment objects, for</span>
<span class="sd"> making custom tests.</span>
<span class="sd">- `EvenniaCommandMixin` - A class mixin that adds support for command testing with the .call()</span>
<span class="sd"> helper. Used by the command-test classes, but can be used for making a customt test class.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">types</span>
<span class="kn">from</span> <span class="nn">twisted.internet.defer</span> <span class="kn">import</span> <span class="n">Deferred</span>
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">django.test</span> <span class="kn">import</span> <span class="n">TestCase</span><span class="p">,</span> <span class="n">override_settings</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span><span class="p">,</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span><span class="p">,</span> <span class="n">patch</span><span class="p">,</span> <span class="n">MagicMock</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">DefaultObject</span><span class="p">,</span> <span class="n">DefaultCharacter</span><span class="p">,</span> <span class="n">DefaultRoom</span><span class="p">,</span> <span class="n">DefaultExit</span>
<span class="kn">from</span> <span class="nn">evennia.accounts.accounts</span> <span class="kn">import</span> <span class="n">DefaultAccount</span>
<span class="kn">from</span> <span class="nn">evennia.scripts.scripts</span> <span class="kn">import</span> <span class="n">DefaultScript</span>
@ -57,8 +79,14 @@
<span class="kn">from</span> <span class="nn">evennia.server.sessionhandler</span> <span class="kn">import</span> <span class="n">SESSIONS</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.utils.idmapper.models</span> <span class="kn">import</span> <span class="n">flush_cache</span>
<span class="kn">from</span> <span class="nn">evennia.utils.utils</span> <span class="kn">import</span> <span class="n">all_from_module</span>
<span class="kn">from</span> <span class="nn">evennia.utils.utils</span> <span class="kn">import</span> <span class="n">all_from_module</span><span class="p">,</span> <span class="n">to_str</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">ansi</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">settings_default</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.muxcommand</span> <span class="kn">import</span> <span class="n">MuxCommand</span>
<span class="kn">from</span> <span class="nn">evennia.commands.command</span> <span class="kn">import</span> <span class="n">InterruptCommand</span>
<span class="n">_RE_STRIP_EVMENU</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^\+|-+\+|\+-+|--+|\|(?:\s|$)&quot;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">MULTILINE</span><span class="p">)</span>
<span class="c1"># set up a &#39;pristine&#39; setting, unaffected by any changes in mygame</span>
@ -101,6 +129,8 @@
<span class="n">FUNCPARSER_PROTOTYPE_PARSING_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.prototypes.protfuncs&quot;</span><span class="p">,</span>
<span class="s2">&quot;evennia.game_template.server.conf.prototypefuncs&quot;</span><span class="p">],</span>
<span class="n">BASE_GUEST_TYPECLASS</span><span class="o">=</span><span class="s2">&quot;evennia.accounts.accounts.DefaultGuest&quot;</span><span class="p">,</span>
<span class="c1"># a special flag; test with settings._TEST_ENVIRONMENT to see if code runs in a test</span>
<span class="n">_TEST_ENVIRONMENT</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span>
<span class="n">DEFAULT_SETTINGS</span> <span class="o">=</span> <span class="p">{</span>
@ -196,7 +226,8 @@
<span class="bp">self</span><span class="o">.</span><span class="n">account2</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span></div>
<span class="c1"># Set up fake prototype module for allowing tests to use named prototypes.</span>
<div class="viewcode-block" id="EvenniaTestMixin.create_rooms"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin.create_rooms">[docs]</a> <span class="nd">@override_settings</span><span class="p">(</span><span class="n">PROTOTYPE_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.utils.tests.data.prototypes_example&quot;</span><span class="p">],</span> <span class="n">DEFAULT_HOME</span><span class="o">=</span><span class="s2">&quot;#1&quot;</span><span class="p">)</span>
<div class="viewcode-block" id="EvenniaTestMixin.create_rooms"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin.create_rooms">[docs]</a> <span class="nd">@override_settings</span><span class="p">(</span><span class="n">PROTOTYPE_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.utils.tests.data.prototypes_example&quot;</span><span class="p">],</span>
<span class="n">DEFAULT_HOME</span><span class="o">=</span><span class="s2">&quot;#1&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">create_rooms</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">room1</span> <span class="o">=</span> <span class="n">create</span><span class="o">.</span><span class="n">create_object</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">room_typeclass</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;Room&quot;</span><span class="p">,</span> <span class="n">nohome</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">desc</span> <span class="o">=</span> <span class="s2">&quot;room_desc&quot;</span>
@ -282,14 +313,275 @@
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">tearDown</span><span class="p">()</span></div></div>
<div class="viewcode-block" id="EvenniaCommandTestMixin"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.server.portal.portal.LoopingCall&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">MagicMock</span><span class="p">())</span>
<span class="k">class</span> <span class="nc">EvenniaCommandTestMixin</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Mixin to add to a test in order to provide the `.call` helper for</span>
<span class="sd"> testing the execution and returns of a command.</span>
<span class="sd"> Tests a Command by running it and comparing what messages it sends with</span>
<span class="sd"> expected values. This tests without actually spinning up the cmdhandler</span>
<span class="sd"> for every test, which is more controlled.</span>
<span class="sd"> Example:</span>
<span class="sd"> ::</span>
<span class="sd"> from commands.echo import CmdEcho</span>
<span class="sd"> class MyCommandTest(EvenniaTest, CommandTestMixin):</span>
<span class="sd"> def test_echo(self):</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> self.call(MyCommand(), &quot;hello world!&quot;,</span>
<span class="sd"> &quot;You hear your echo: &#39;Hello world!&#39;&quot;)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># formatting for .call&#39;s error message</span>
<span class="n">_ERROR_FORMAT</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="s2">=========================== Wanted message ===================================</span>
<span class="si">{expected_msg}</span><span class="s2"></span>
<span class="s2">=========================== Returned message =================================</span>
<span class="si">{returned_msg}</span><span class="s2"></span>
<span class="s2">==============================================================================</span>
<span class="s2">&quot;&quot;&quot;</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
<div class="viewcode-block" id="EvenniaCommandTestMixin.call"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call">[docs]</a> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">cmdobj</span><span class="p">,</span>
<span class="n">input_args</span><span class="p">,</span>
<span class="n">msg</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdset</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">noansi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">caller</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">receiver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdstring</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">obj</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">inputs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">raw_string</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test a command by assigning all the needed properties to a cmdobj and</span>
<span class="sd"> running the sequence. The resulting `.msg` calls will be mocked and</span>
<span class="sd"> the text= calls to them compared to a expected output.</span>
<span class="sd"> Args:</span>
<span class="sd"> cmdobj (Command): The command object to use.</span>
<span class="sd"> input_args (str): This should be the full input the Command should</span>
<span class="sd"> see, such as &#39;look here&#39;. This will become `.args` for the Command</span>
<span class="sd"> instance to parse.</span>
<span class="sd"> msg (str or dict, optional): This is the expected return value(s)</span>
<span class="sd"> returned through `caller.msg(text=...)` calls in the command. If a string, the</span>
<span class="sd"> receiver is controlled with the `receiver` kwarg (defaults to `caller`).</span>
<span class="sd"> If this is a `dict`, it is a mapping</span>
<span class="sd"> `{receiver1: &quot;expected1&quot;, receiver2: &quot;expected2&quot;,...}` and `receiver` is</span>
<span class="sd"> ignored. The message(s) are compared with the actual messages returned</span>
<span class="sd"> to the receiver(s) as the Command runs. Each check uses `.startswith`,</span>
<span class="sd"> so you can choose to only include the first part of the</span>
<span class="sd"> returned message if that&#39;s enough to verify a correct result. EvMenu</span>
<span class="sd"> decorations (like borders) are stripped and should not be included. This</span>
<span class="sd"> should also not include color tags unless `noansi=False`.</span>
<span class="sd"> If the command returns texts in multiple separate `.msg`-</span>
<span class="sd"> calls to a receiver, separate these with `|` if `noansi=True`</span>
<span class="sd"> (default) and `||` if `noansi=False`. If no `msg` is given (`None`),</span>
<span class="sd"> then no automatic comparison will be done.</span>
<span class="sd"> cmdset (str, optional): If given, make `.cmdset` available on the Command</span>
<span class="sd"> instance as it runs. While `.cmdset` is normally available on the</span>
<span class="sd"> Command instance by default, this is usually only used by</span>
<span class="sd"> commands that explicitly operates/displays cmdsets, like</span>
<span class="sd"> `examine`.</span>
<span class="sd"> noansi (str, optional): By default the color tags of the `msg` is</span>
<span class="sd"> ignored, this makes them significant. If unset, `msg` must contain</span>
<span class="sd"> the same color tags as the actual return message.</span>
<span class="sd"> caller (Object or Account, optional): By default `self.char1` is used as the</span>
<span class="sd"> command-caller (the `.caller` property on the Command). This allows to</span>
<span class="sd"> execute with another caller, most commonly an Account.</span>
<span class="sd"> receiver (Object or Account, optional): This is the object to receive the</span>
<span class="sd"> return messages we want to test. By default this is the same as `caller`</span>
<span class="sd"> (which in turn defaults to is `self.char1`). Note that if `msg` is</span>
<span class="sd"> a `dict`, this is ignored since the receiver is already specified there.</span>
<span class="sd"> cmdstring (str, optional): Normally this is the Command&#39;s `key`.</span>
<span class="sd"> This allows for tweaking the `.cmdname` property of the</span>
<span class="sd"> Command`. This isb used for commands with multiple aliases,</span>
<span class="sd"> where the command explicitly checs which alias was used to</span>
<span class="sd"> determine its functionality.</span>
<span class="sd"> obj (str, optional): This sets the `.obj` property of the Command - the</span>
<span class="sd"> object on which the Command &#39;sits&#39;. By default this is the same as `caller`.</span>
<span class="sd"> This can be used for testing on-object Command interactions.</span>
<span class="sd"> inputs (list, optional): A list of strings to pass to functions that pause to</span>
<span class="sd"> take input from the user (normally using `@interactive` and</span>
<span class="sd"> `ret = yield(question)` or `evmenu.get_input`). Each element of the</span>
<span class="sd"> list will be passed into the command as if the user wrote that at the prompt.</span>
<span class="sd"> raw_string (str, optional): Normally the `.raw_string` property is set as</span>
<span class="sd"> a combination of your `key/cmdname` and `input_args`. This allows</span>
<span class="sd"> direct control of what this is, for example for testing edge cases</span>
<span class="sd"> or malformed inputs.</span>
<span class="sd"> Returns:</span>
<span class="sd"> str or dict: The message sent to `receiver`, or a dict of</span>
<span class="sd"> `{receiver: &quot;msg&quot;, ...}` if multiple are given. This is usually</span>
<span class="sd"> only used with `msg=None` to do the validation externally.</span>
<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If the returns of `.msg` calls (tested with `.startswith`) does not</span>
<span class="sd"> match `expected_input`.</span>
<span class="sd"> Notes:</span>
<span class="sd"> As part of the tests, all methods of the Command will be called in</span>
<span class="sd"> the proper order:</span>
<span class="sd"> - cmdobj.at_pre_cmd()</span>
<span class="sd"> - cmdobj.parse()</span>
<span class="sd"> - cmdobj.func()</span>
<span class="sd"> - cmdobj.at_post_cmd()</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># The `self.char1` is created in the `EvenniaTest` base along with</span>
<span class="c1"># other helper objects like self.room and self.obj</span>
<span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="o">=</span> <span class="n">cmdstring</span> <span class="k">if</span> <span class="n">cmdstring</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_cmdname</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdstring</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="c1"># deprecated</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdset</span> <span class="o">=</span> <span class="n">cmdset</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">SESSIONS</span><span class="o">.</span><span class="n">session_from_sessid</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">account</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">account</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_string</span> <span class="o">=</span> <span class="n">raw_string</span> <span class="k">if</span> <span class="n">raw_string</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> <span class="ow">or</span> <span class="p">(</span><span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">)</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="n">inputs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="c1"># set up receivers</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="c1"># a mapping {receiver: msg, ...}</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">recv</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">recv</span><span class="p">,</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">msg</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># a single expected string and thus a single receiver (defaults to caller)</span>
<span class="n">receiver</span> <span class="o">=</span> <span class="n">receiver</span> <span class="k">if</span> <span class="n">receiver</span> <span class="k">else</span> <span class="n">caller</span>
<span class="n">receiver_mapping</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">unmocked_msg_methods</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="p">:</span>
<span class="c1"># save the old .msg method so we can get it back</span>
<span class="c1"># cleanly after the test</span>
<span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span>
<span class="c1"># replace normal `.msg` with a mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="c1"># Run the methods of the Command. This mimics what happens in the</span>
<span class="c1"># cmdhandler. This will have the mocked .msg be called as part of the</span>
<span class="c1"># execution. Mocks remembers what was sent to them so we will be able</span>
<span class="c1"># to retrieve what was sent later.</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">at_pre_cmd</span><span class="p">():</span>
<span class="k">return</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">parse</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
<span class="c1"># handle func&#39;s with yield in them (making them generators)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">GeneratorType</span><span class="p">):</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">inp</span> <span class="o">=</span> <span class="n">inputs</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="k">if</span> <span class="n">inputs</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">if</span> <span class="n">inp</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># this mimics a user&#39;s reply to a prompt</span>
<span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># non-input yield, like yield(10). We don&#39;t pause</span>
<span class="c1"># but fire it immediately.</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">at_post_cmd</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">except</span> <span class="n">InterruptCommand</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">for</span> <span class="n">inp</span> <span class="ow">in</span> <span class="n">inputs</span><span class="p">:</span>
<span class="c1"># if there are any inputs left, we may have a non-generator</span>
<span class="c1"># input to handle (get_input/ask_yes_no that uses a separate</span>
<span class="c1"># cmdset rather than a yield</span>
<span class="n">caller</span><span class="o">.</span><span class="n">execute_cmd</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="c1"># At this point the mocked .msg methods on each receiver will have</span>
<span class="c1"># stored all calls made to them (that&#39;s a basic function of the Mock</span>
<span class="c1"># class). We will not extract them and compare to what we expected to</span>
<span class="c1"># go to each receiver.</span>
<span class="n">returned_msgs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span><span class="p">,</span> <span class="n">expected_msg</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="c1"># get the stored messages from the Mock with Mock.mock_calls.</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">else</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">,</span> <span class="n">to_str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">))</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span> <span class="ow">in</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span><span class="o">.</span><span class="n">mock_calls</span>
<span class="p">]</span>
<span class="c1"># we can return this now, we are done using the mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span>
<span class="c1"># Get the first element of a tuple if msg received a tuple instead of a string</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">smsg</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)</span> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">)</span> <span class="k">for</span> <span class="n">smsg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">]</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># no expected_msg; just build the returned_msgs dict</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">returned_msg</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># compare messages to expected</span>
<span class="c1"># set our separator for returned messages based on parsing ansi or not</span>
<span class="n">msg_sep</span> <span class="o">=</span> <span class="s2">&quot;|&quot;</span> <span class="k">if</span> <span class="n">noansi</span> <span class="k">else</span> <span class="s2">&quot;||&quot;</span>
<span class="c1"># We remove Evmenu decorations since that just makes it harder</span>
<span class="c1"># to write the comparison string. We also strip ansi before this</span>
<span class="c1"># comparison since otherwise it would mess with the regex.</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="n">msg_sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
<span class="n">_RE_STRIP_EVMENU</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span>
<span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">mess</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">))</span>
<span class="k">for</span> <span class="n">mess</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="c1"># this is the actual test</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="ow">and</span> <span class="n">returned_msg</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">returned_msg</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">expected_msg</span><span class="p">):</span>
<span class="c1"># failed the test</span>
<span class="k">raise</span> <span class="ne">AssertionError</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ERROR_FORMAT</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">expected_msg</span><span class="o">=</span><span class="n">expected_msg</span><span class="p">,</span> <span class="n">returned_msg</span><span class="o">=</span><span class="n">returned_msg</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># passed!</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">returned_msg</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">returned_msgs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">returned_msgs</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">return</span> <span class="n">returned_msgs</span></div></div>
<span class="c1"># Base testing classes</span>
<div class="viewcode-block" id="BaseEvenniaTestCase"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTestCase">[docs]</a><span class="nd">@override_settings</span><span class="p">(</span><span class="o">**</span><span class="n">DEFAULT_SETTINGS</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaTestCase</span><span class="p">(</span><span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Base test (with no default objects) but with</span>
<span class="sd"> enforced default settings.</span>
<span class="sd"> Base test (with no default objects) but with enforced default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaTestCase"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestCase">[docs]</a><span class="k">class</span> <span class="nc">EvenniaTestCase</span><span class="p">(</span><span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> For use with gamedir settings; Just like the normal test case, only for naming consistency.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span></div>
<div class="viewcode-block" id="BaseEvenniaTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest">[docs]</a><span class="nd">@override_settings</span><span class="p">(</span><span class="o">**</span><span class="n">DEFAULT_SETTINGS</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaTest</span><span class="p">(</span><span class="n">EvenniaTestMixin</span><span class="p">,</span> <span class="n">TestCase</span><span class="p">):</span>
@ -298,7 +590,6 @@
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest">[docs]</a><span class="k">class</span> <span class="nc">EvenniaTest</span><span class="p">(</span><span class="n">EvenniaTestMixin</span><span class="p">,</span> <span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This test class is intended for inheriting in mygame tests.</span>
@ -313,6 +604,31 @@
<span class="n">exit_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_EXIT_TYPECLASS</span>
<span class="n">room_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_ROOM_TYPECLASS</span>
<span class="n">script_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_SCRIPT_TYPECLASS</span></div>
<div class="viewcode-block" id="BaseEvenniaCommandTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.account.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.admin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.batchprocess.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.building.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.comms.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.general.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.help.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.syscommands.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.system.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.unloggedin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaCommandTest</span><span class="p">(</span><span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">EvenniaCommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Commands only using the default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaCommandTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTest">[docs]</a><span class="k">class</span> <span class="nc">EvenniaCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">EvenniaCommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parent class to inherit from - makes tests use your own</span>
<span class="sd"> classes and settings in mygame.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
</pre></div>
<div class="clearer"></div>

View file

@ -72,7 +72,7 @@ method. Otherwise all text will be returned to all connected sessions.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.account.CmdOOCLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -103,7 +103,7 @@ method. Otherwise all text will be returned to all connected sessions.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.account.CmdOOCLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look while out-of-character\n\n Usage:\n look\n\n Look in the ooc state.\n '}</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n look while out-of-character\n\n Usage:\n look\n\n Look in the ooc state.\n '}</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -77,7 +77,7 @@ skipping, reloading etc.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.batchprocess.CmdBatchCommands.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['batchcmd', 'batchcommand']</em><a class="headerlink" href="#evennia.commands.default.batchprocess.CmdBatchCommands.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['batchcommand', 'batchcmd']</em><a class="headerlink" href="#evennia.commands.default.batchprocess.CmdBatchCommands.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -108,7 +108,7 @@ skipping, reloading etc.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.batchprocess.CmdBatchCommands.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'batchcmd batchcommand', 'category': 'building', 'key': 'batchcommands', 'no_prefix': ' batchcmd batchcommand', 'tags': '', 'text': '\n build from batch-command file\n\n Usage:\n batchcommands[/interactive] &lt;python.path.to.file&gt;\n\n Switch:\n interactive - this mode will offer more control when\n executing the batch file, like stepping,\n skipping, reloading etc.\n\n Runs batches of commands from a batch-cmd text file (*.ev).\n\n '}</em><a class="headerlink" href="#evennia.commands.default.batchprocess.CmdBatchCommands.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'batchcommand batchcmd', 'category': 'building', 'key': 'batchcommands', 'no_prefix': ' batchcommand batchcmd', 'tags': '', 'text': '\n build from batch-command file\n\n Usage:\n batchcommands[/interactive] &lt;python.path.to.file&gt;\n\n Switch:\n interactive - this mode will offer more control when\n executing the batch file, like stepping,\n skipping, reloading etc.\n\n Runs batches of commands from a batch-cmd text file (*.ev).\n\n '}</em><a class="headerlink" href="#evennia.commands.default.batchprocess.CmdBatchCommands.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -1284,7 +1284,7 @@ server settings.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdTypeclass.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;swap', '&#64;type', '&#64;update', '&#64;parent', '&#64;typeclasses']</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;typeclasses', '&#64;swap', '&#64;update', '&#64;type', '&#64;parent']</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -1315,7 +1315,7 @@ server settings.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdTypeclass.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;swap &#64;type &#64;update &#64;parent &#64;typeclasses', 'category': 'building', 'key': '&#64;typeclass', 'no_prefix': 'typeclass swap type update parent typeclasses', 'tags': '', 'text': &quot;\n set or change an object's typeclass\n\n Usage:\n typeclass[/switch] &lt;object&gt; [= typeclass.path]\n typeclass/prototype &lt;object&gt; = prototype_key\n\n typeclasses or typeclass/list/show [typeclass.path]\n swap - this is a shorthand for using /force/reset flags.\n update - this is a shorthand for using the /force/reload flag.\n\n Switch:\n show, examine - display the current typeclass of object (default) or, if\n given a typeclass path, show the docstring of that typeclass.\n update - *only* re-run at_object_creation on this object\n meaning locks or other properties set later may remain.\n reset - clean out *all* the attributes and properties on the\n object - basically making this a new clean object. This will also\n reset cmdsets!\n force - change to the typeclass also if the object\n already has a typeclass of the same name.\n list - show available typeclasses. Only typeclasses in modules actually\n imported or used from somewhere in the code will show up here\n (those typeclasses are still available if you know the path)\n prototype - clean and overwrite the object with the specified\n prototype key - effectively making a whole new object.\n\n Example:\n type button = examples.red_button.RedButton\n type/prototype button=a red button\n\n If the typeclass_path is not given, the current object's typeclass is\n assumed.\n\n View or set an object's typeclass. If setting, the creation hooks of the\n new typeclass will be run on the object. If you have clashing properties on\n the old class, use /reset. By default you are protected from changing to a\n typeclass of the same name as the one you already have - use /force to\n override this protection.\n\n The given typeclass must be identified by its location using python\n dot-notation pointing to the correct module and class. If no typeclass is\n given (or a wrong typeclass is given). Errors in the path or new typeclass\n will lead to the old typeclass being kept. The location of the typeclass\n module is searched from the default typeclass directory, as defined in the\n server settings.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;typeclasses &#64;swap &#64;update &#64;type &#64;parent', 'category': 'building', 'key': '&#64;typeclass', 'no_prefix': 'typeclass typeclasses swap update type parent', 'tags': '', 'text': &quot;\n set or change an object's typeclass\n\n Usage:\n typeclass[/switch] &lt;object&gt; [= typeclass.path]\n typeclass/prototype &lt;object&gt; = prototype_key\n\n typeclasses or typeclass/list/show [typeclass.path]\n swap - this is a shorthand for using /force/reset flags.\n update - this is a shorthand for using the /force/reload flag.\n\n Switch:\n show, examine - display the current typeclass of object (default) or, if\n given a typeclass path, show the docstring of that typeclass.\n update - *only* re-run at_object_creation on this object\n meaning locks or other properties set later may remain.\n reset - clean out *all* the attributes and properties on the\n object - basically making this a new clean object. This will also\n reset cmdsets!\n force - change to the typeclass also if the object\n already has a typeclass of the same name.\n list - show available typeclasses. Only typeclasses in modules actually\n imported or used from somewhere in the code will show up here\n (those typeclasses are still available if you know the path)\n prototype - clean and overwrite the object with the specified\n prototype key - effectively making a whole new object.\n\n Example:\n type button = examples.red_button.RedButton\n type/prototype button=a red button\n\n If the typeclass_path is not given, the current object's typeclass is\n assumed.\n\n View or set an object's typeclass. If setting, the creation hooks of the\n new typeclass will be run on the object. If you have clashing properties on\n the old class, use /reset. By default you are protected from changing to a\n typeclass of the same name as the one you already have - use /force to\n override this protection.\n\n The given typeclass must be identified by its location using python\n dot-notation pointing to the correct module and class. If no typeclass is\n given (or a wrong typeclass is given). Errors in the path or new typeclass\n will lead to the old typeclass being kept. The location of the typeclass\n module is searched from the default typeclass directory, as defined in the\n server settings.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -1772,7 +1772,7 @@ one is given.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdFind.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;search', '&#64;locate']</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;locate', '&#64;search']</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -1803,7 +1803,7 @@ one is given.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdFind.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;search &#64;locate', 'category': 'building', 'key': '&#64;find', 'no_prefix': 'find search locate', 'tags': '', 'text': '\n search the database for objects\n\n Usage:\n find[/switches] &lt;name or dbref or *account&gt; [= dbrefmin[-dbrefmax]]\n locate - this is a shorthand for using the /loc switch.\n\n Switches:\n room - only look for rooms (location=None)\n exit - only look for exits (destination!=None)\n char - only look for characters (BASE_CHARACTER_TYPECLASS)\n exact - only exact matches are returned.\n loc - display object location if exists and match has one result\n startswith - search for names starting with the string, rather than containing\n\n Searches the database for an object of a particular name or exact #dbref.\n Use *accountname to search for an account. The switches allows for\n limiting object matches to certain game entities. Dbrefmin and dbrefmax\n limits matches to within the given dbrefs range, or above/below if only\n one is given.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;locate &#64;search', 'category': 'building', 'key': '&#64;find', 'no_prefix': 'find locate search', 'tags': '', 'text': '\n search the database for objects\n\n Usage:\n find[/switches] &lt;name or dbref or *account&gt; [= dbrefmin[-dbrefmax]]\n locate - this is a shorthand for using the /loc switch.\n\n Switches:\n room - only look for rooms (location=None)\n exit - only look for exits (destination!=None)\n char - only look for characters (BASE_CHARACTER_TYPECLASS)\n exact - only exact matches are returned.\n loc - display object location if exists and match has one result\n startswith - search for names starting with the string, rather than containing\n\n Searches the database for an object of a particular name or exact #dbref.\n Use *accountname to search for an account. The switches allows for\n limiting object matches to certain game entities. Dbrefmin and dbrefmax\n limits matches to within the given dbrefs range, or above/below if only\n one is given.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

File diff suppressed because one or more lines are too long

View file

@ -114,7 +114,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -145,7 +145,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look &lt;obj&gt;\n look *&lt;account&gt;\n\n Observes your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look &lt;obj&gt;\n look *&lt;account&gt;\n\n Observes your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -207,7 +207,7 @@ for everyone to use, you need build privileges and the alias command.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdNick.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['nickname', 'nicks']</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['nicks', 'nickname']</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -239,7 +239,7 @@ for everyone to use, you need build privileges and the alias command.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdNick.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'nickname nicks', 'category': 'general', 'key': 'nick', 'no_prefix': ' nickname nicks', 'tags': '', 'text': '\n define a personal alias/nick by defining a string to\n match and replace it with another on the fly\n\n Usage:\n nick[/switches] &lt;string&gt; [= [replacement_string]]\n nick[/switches] &lt;template&gt; = &lt;replacement_template&gt;\n nick/delete &lt;string&gt; or number\n nicks\n\n Switches:\n inputline - replace on the inputline (default)\n object - replace on object-lookup\n account - replace on account-lookup\n list - show all defined aliases (also &quot;nicks&quot; works)\n delete - remove nick by index in /list\n clearall - clear all nicks\n\n Examples:\n nick hi = say Hello, I\'m Sarah!\n nick/object tom = the tall man\n nick build $1 $2 = create/drop $1;$2\n nick tell $1 $2=page $1=$2\n nick tm?$1=page tallman=$1\n nick tm\\=$1=page tallman=$1\n\n A \'nick\' is a personal string replacement. Use $1, $2, ... to catch arguments.\n Put the last $-marker without an ending space to catch all remaining text. You\n can also use unix-glob matching for the left-hand side &lt;string&gt;:\n\n * - matches everything\n ? - matches 0 or 1 single characters\n [abcd] - matches these chars in any order\n [!abcd] - matches everything not among these chars\n \\= - escape literal \'=\' you want in your &lt;string&gt;\n\n Note that no objects are actually renamed or changed by this command - your nicks\n are only available to you. If you want to permanently add keywords to an object\n for everyone to use, you need build privileges and the alias command.\n\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'nicks nickname', 'category': 'general', 'key': 'nick', 'no_prefix': ' nicks nickname', 'tags': '', 'text': '\n define a personal alias/nick by defining a string to\n match and replace it with another on the fly\n\n Usage:\n nick[/switches] &lt;string&gt; [= [replacement_string]]\n nick[/switches] &lt;template&gt; = &lt;replacement_template&gt;\n nick/delete &lt;string&gt; or number\n nicks\n\n Switches:\n inputline - replace on the inputline (default)\n object - replace on object-lookup\n account - replace on account-lookup\n list - show all defined aliases (also &quot;nicks&quot; works)\n delete - remove nick by index in /list\n clearall - clear all nicks\n\n Examples:\n nick hi = say Hello, I\'m Sarah!\n nick/object tom = the tall man\n nick build $1 $2 = create/drop $1;$2\n nick tell $1 $2=page $1=$2\n nick tm?$1=page tallman=$1\n nick tm\\=$1=page tallman=$1\n\n A \'nick\' is a personal string replacement. Use $1, $2, ... to catch arguments.\n Put the last $-marker without an ending space to catch all remaining text. You\n can also use unix-glob matching for the left-hand side &lt;string&gt;:\n\n * - matches everything\n ? - matches 0 or 1 single characters\n [abcd] - matches these chars in any order\n [!abcd] - matches everything not among these chars\n \\= - escape literal \'=\' you want in your &lt;string&gt;\n\n Note that no objects are actually renamed or changed by this command - your nicks\n are only available to you. If you want to permanently add keywords to an object\n for everyone to use, you need build privileges and the alias command.\n\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -262,7 +262,7 @@ inv</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdInventory.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['i', 'inv']</em><a class="headerlink" href="#evennia.commands.default.general.CmdInventory.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['inv', 'i']</em><a class="headerlink" href="#evennia.commands.default.general.CmdInventory.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -293,7 +293,7 @@ inv</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdInventory.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'i inv', 'category': 'general', 'key': 'inventory', 'no_prefix': ' i inv', 'tags': '', 'text': '\n view inventory\n\n Usage:\n inventory\n inv\n\n Shows your inventory.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdInventory.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'inv i', 'category': 'general', 'key': 'inventory', 'no_prefix': ' inv i', 'tags': '', 'text': '\n view inventory\n\n Usage:\n inventory\n inv\n\n Shows your inventory.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdInventory.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -537,7 +537,7 @@ placing it in their inventory.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdSay.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&quot;', &quot;'&quot;]</em><a class="headerlink" href="#evennia.commands.default.general.CmdSay.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = [&quot;'&quot;, '&quot;']</em><a class="headerlink" href="#evennia.commands.default.general.CmdSay.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -568,7 +568,7 @@ placing it in their inventory.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdSay.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&quot; \'', 'category': 'general', 'key': 'say', 'no_prefix': ' &quot; \'', 'tags': '', 'text': '\n speak as your character\n\n Usage:\n say &lt;message&gt;\n\n Talk to those in your current location.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdSay.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '\' &quot;', 'category': 'general', 'key': 'say', 'no_prefix': ' \' &quot;', 'tags': '', 'text': '\n speak as your character\n\n Usage:\n say &lt;message&gt;\n\n Talk to those in your current location.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdSay.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -712,7 +712,7 @@ which permission groups you are a member of.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdAccess.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['groups', 'hierarchy']</em><a class="headerlink" href="#evennia.commands.default.general.CmdAccess.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['hierarchy', 'groups']</em><a class="headerlink" href="#evennia.commands.default.general.CmdAccess.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -743,7 +743,7 @@ which permission groups you are a member of.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdAccess.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'groups hierarchy', 'category': 'general', 'key': 'access', 'no_prefix': ' groups hierarchy', 'tags': '', 'text': '\n show your current game access\n\n Usage:\n access\n\n This command shows you the permission hierarchy and\n which permission groups you are a member of.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdAccess.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'hierarchy groups', 'category': 'general', 'key': 'access', 'no_prefix': ' hierarchy groups', 'tags': '', 'text': '\n show your current game access\n\n Usage:\n access\n\n This command shows you the permission hierarchy and\n which permission groups you are a member of.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdAccess.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -49,136 +49,10 @@ main test suite started with</p>
<blockquote>
<div><p>&gt; python game/manage.py test.</p>
</div></blockquote>
<dl class="py class">
<dt id="evennia.commands.default.tests.CommandTestMixin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">CommandTestMixin</code><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTestMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTestMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Mixin to add to a test in order to provide the <strong>.call</strong> helper for
testing the execution and returns of a command.</p>
<p>Tests a Command by running it and comparing what messages it sends with
expected values. This tests without actually spinning up the cmdhandler
for every test, which is more controlled.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">commands.echo</span> <span class="kn">import</span> <span class="n">CmdEcho</span>
<span class="k">class</span> <span class="nc">MyCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_echo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">MyCommand</span><span class="p">(),</span> <span class="s2">&quot;hello world!&quot;</span><span class="p">,</span>
<span class="s2">&quot;You hear your echo: &#39;Hello world!&#39;&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt id="evennia.commands.default.tests.CommandTestMixin.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdobj</span></em>, <em class="sig-param"><span class="n">input_args</span></em>, <em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdset</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">noansi</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">caller</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">receiver</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdstring</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">raw_string</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTestMixin.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTestMixin.call" title="Permalink to this definition"></a></dt>
<dd><p>Test a command by assigning all the needed properties to a cmdobj and
running the sequence. The resulting <strong>.msg</strong> calls will be mocked and
the text= calls to them compared to a expected output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cmdobj</strong> (<a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><em>Command</em></a>) The command object to use.</p></li>
<li><p><strong>input_args</strong> (<em>str</em>) This should be the full input the Command should
see, such as look here. This will become <strong>.args</strong> for the Command
instance to parse.</p></li>
<li><p><strong>msg</strong> (<em>str</em><em> or </em><em>dict</em><em>, </em><em>optional</em>) This is the expected return value(s)
returned through <strong>caller.msg(text=…)</strong> calls in the command. If a string, the
receiver is controlled with the <strong>receiver</strong> kwarg (defaults to <strong>caller</strong>).
If this is a <strong>dict</strong>, it is a mapping
<strong>{receiver1: “expected1”, receiver2: “expected2”,…}</strong> and <strong>receiver</strong> is
ignored. The message(s) are compared with the actual messages returned
to the receiver(s) as the Command runs. Each check uses <strong>.startswith</strong>,
so you can choose to only include the first part of the
returned message if thats enough to verify a correct result. EvMenu
decorations (like borders) are stripped and should not be included. This
should also not include color tags unless <strong>noansi=False</strong>.
If the command returns texts in multiple separate <strong>.msg</strong>-
calls to a receiver, separate these with <strong>|</strong> if <strong>noansi=True</strong>
(default) and <strong>||</strong> if <strong>noansi=False</strong>. If no <strong>msg</strong> is given (<strong>None</strong>),
then no automatic comparison will be done.</p></li>
<li><p><strong>cmdset</strong> (<em>str</em><em>, </em><em>optional</em>) If given, make <strong>.cmdset</strong> available on the Command
instance as it runs. While <strong>.cmdset</strong> is normally available on the
Command instance by default, this is usually only used by
commands that explicitly operates/displays cmdsets, like
<strong>examine</strong>.</p></li>
<li><p><strong>noansi</strong> (<em>str</em><em>, </em><em>optional</em>) By default the color tags of the <strong>msg</strong> is
ignored, this makes them significant. If unset, <strong>msg</strong> must contain
the same color tags as the actual return message.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) By default <strong>self.char1</strong> is used as the
command-caller (the <strong>.caller</strong> property on the Command). This allows to
execute with another caller, most commonly an Account.</p></li>
<li><p><strong>receiver</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) This is the object to receive the
return messages we want to test. By default this is the same as <strong>caller</strong>
(which in turn defaults to is <strong>self.char1</strong>). Note that if <strong>msg</strong> is
a <strong>dict</strong>, this is ignored since the receiver is already specified there.</p></li>
<li><p><strong>cmdstring</strong> (<em>str</em><em>, </em><em>optional</em>) Normally this is the Commands <strong>key</strong>.
This allows for tweaking the <strong>.cmdname</strong> property of the
Command**. This isb used for commands with multiple aliases,
where the command explicitly checs which alias was used to
determine its functionality.</p></li>
<li><p><strong>obj</strong> (<em>str</em><em>, </em><em>optional</em>) This sets the <strong>.obj</strong> property of the Command - the
object on which the Command sits. By default this is the same as <strong>caller</strong>.
This can be used for testing on-object Command interactions.</p></li>
<li><p><strong>inputs</strong> (<em>list</em><em>, </em><em>optional</em>) A list of strings to pass to functions that pause to
take input from the user (normally using <strong>&#64;interactive</strong> and
<strong>ret = yield(question)</strong> or <strong>evmenu.get_input</strong>). Each element of the
list will be passed into the command as if the user wrote that at the prompt.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em><em>, </em><em>optional</em>) Normally the <strong>.raw_string</strong> property is set as
a combination of your <strong>key/cmdname</strong> and <strong>input_args</strong>. This allows
direct control of what this is, for example for testing edge cases
or malformed inputs.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>str or dict</em> </p>
<dl class="simple">
<dt>The message sent to <strong>receiver</strong>, or a dict of</dt><dd><p><strong>{receiver: “msg”, …}</strong> if multiple are given. This is usually
only used with <strong>msg=None</strong> to do the validation externally.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>AssertionError</strong> If the returns of <strong>.msg</strong> calls (tested with <strong>.startswith</strong>) does not
match <strong>expected_input</strong>.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>As part of the tests, all methods of the Command will be called in
the proper order:</p>
<ul class="simple">
<li><p>cmdobj.at_pre_cmd()</p></li>
<li><p>cmdobj.parse()</p></li>
<li><p>cmdobj.func()</p></li>
<li><p>cmdobj.at_post_cmd()</p></li>
</ul>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.EvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">EvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#EvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.EvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest" title="evennia.utils.test_resources.BaseEvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.commands.default.tests.CommandTestMixin" title="evennia.commands.default.tests.CommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.CommandTestMixin</span></code></a></p>
<p>Commands only using the default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.CommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">CommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.commands.default.tests.CommandTestMixin" title="evennia.commands.default.tests.CommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.CommandTestMixin</span></code></a></p>
<p>Parent class to inherit from - makes tests use your own
classes and settings in mygame.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestGeneral">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestGeneral</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestGeneral"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestGeneral" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestGeneral.test_look">
<code class="sig-name descname">test_look</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestGeneral.test_look"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestGeneral.test_look" title="Permalink to this definition"></a></dt>
@ -239,7 +113,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestHelp">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestHelp</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestHelp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestHelp" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py attribute">
<dt id="evennia.commands.default.tests.TestHelp.maxDiff">
<code class="sig-name descname">maxDiff</code><em class="property"> = None</em><a class="headerlink" href="#evennia.commands.default.tests.TestHelp.maxDiff" title="Permalink to this definition"></a></dt>
@ -349,7 +223,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestSystem">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestSystem</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystem"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystem" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestSystem.test_py">
<code class="sig-name descname">test_py</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystem.test_py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystem.test_py" title="Permalink to this definition"></a></dt>
@ -385,7 +259,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestCmdTasks">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestCmdTasks</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCmdTasks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCmdTasks" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestCmdTasks.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCmdTasks.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCmdTasks.setUp" title="Permalink to this definition"></a></dt>
@ -480,7 +354,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestAdmin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestAdmin</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAdmin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAdmin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestAdmin.test_emit">
<code class="sig-name descname">test_emit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAdmin.test_emit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAdmin.test_emit" title="Permalink to this definition"></a></dt>
@ -511,7 +385,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestAccount">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestAccount</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAccount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAccount" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestAccount.test_ooc_look">
<code class="sig-name descname">test_ooc_look</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAccount.test_ooc_look"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAccount.test_ooc_look" title="Permalink to this definition"></a></dt>
@ -587,7 +461,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestBuilding">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestBuilding</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBuilding"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBuilding" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestBuilding.test_create">
<code class="sig-name descname">test_create</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBuilding.test_create"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBuilding.test_create" title="Permalink to this definition"></a></dt>
@ -735,7 +609,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestCommsChannel">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestCommsChannel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCommsChannel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCommsChannel" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the central <strong>channel</strong> command.</p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestCommsChannel.setUp">
@ -846,7 +720,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestComms">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestComms</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestComms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestComms" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestComms.test_page">
<code class="sig-name descname">test_page</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestComms.test_page"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestComms.test_page" title="Permalink to this definition"></a></dt>
@ -857,7 +731,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestBatchProcess">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestBatchProcess</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBatchProcess"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBatchProcess" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the batch processor.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.tests.TestBatchProcess.red_button">
@ -976,7 +850,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestInterruptCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestInterruptCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestInterruptCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestInterruptCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command">
<code class="sig-name descname">test_interrupt_command</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestInterruptCommand.test_interrupt_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command" title="Permalink to this definition"></a></dt>
@ -987,7 +861,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestUnconnectedCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestUnconnectedCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestUnconnectedCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestUnconnectedCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestUnconnectedCommand.test_info_command">
<code class="sig-name descname">test_info_command</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestUnconnectedCommand.test_info_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestUnconnectedCommand.test_info_command" title="Permalink to this definition"></a></dt>
@ -998,7 +872,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestSystemCommands">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestSystemCommands</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystemCommands"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystemCommands" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestSystemCommands.test_simple_defaults">
<code class="sig-name descname">test_simple_defaults</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystemCommands.test_simple_defaults"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystemCommands.test_simple_defaults" title="Permalink to this definition"></a></dt>

View file

@ -61,7 +61,7 @@ connect “account name” “pass word”</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['conn', 'co', 'con']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['conn', 'con', 'co']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -96,7 +96,7 @@ there is no object yet before the account has logged in)</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'conn co con', 'category': 'general', 'key': 'connect', 'no_prefix': ' conn co con', 'tags': '', 'text': '\n connect to the game\n\n Usage (at login screen):\n connect accountname password\n connect &quot;account name&quot; &quot;pass word&quot;\n\n Use the create command to first create an account before logging in.\n\n If you have spaces in your name, enclose it in double quotes.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'conn con co', 'category': 'general', 'key': 'connect', 'no_prefix': ' conn con co', 'tags': '', 'text': '\n connect to the game\n\n Usage (at login screen):\n connect accountname password\n connect &quot;account name&quot; &quot;pass word&quot;\n\n Use the create command to first create an account before logging in.\n\n If you have spaces in your name, enclose it in double quotes.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -175,7 +175,7 @@ version is a bit more complicated.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedQuit.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['qu', 'q']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedQuit.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['q', 'qu']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedQuit.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -201,7 +201,7 @@ version is a bit more complicated.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedQuit.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'qu q', 'category': 'general', 'key': 'quit', 'no_prefix': ' qu q', 'tags': '', 'text': '\n quit when in unlogged-in state\n\n Usage:\n quit\n\n We maintain a different version of the quit command\n here for unconnected accounts for the sake of simplicity. The logged in\n version is a bit more complicated.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedQuit.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'q qu', 'category': 'general', 'key': 'quit', 'no_prefix': ' q qu', 'tags': '', 'text': '\n quit when in unlogged-in state\n\n Usage:\n quit\n\n We maintain a different version of the quit command\n here for unconnected accounts for the sake of simplicity. The logged in\n version is a bit more complicated.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedQuit.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -225,7 +225,7 @@ All it does is display the connect screen.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'look']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['look', 'l']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -251,7 +251,7 @@ All it does is display the connect screen.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l look', 'category': 'general', 'key': '__unloggedin_look_command', 'no_prefix': ' l look', 'tags': '', 'text': '\n look when in unlogged-in state\n\n Usage:\n look\n\n This is an unconnected version of the look command for simplicity.\n\n This is called by the server and kicks everything in gear.\n All it does is display the connect screen.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'look l', 'category': 'general', 'key': '__unloggedin_look_command', 'no_prefix': ' look l', 'tags': '', 'text': '\n look when in unlogged-in state\n\n Usage:\n look\n\n This is an unconnected version of the look command for simplicity.\n\n This is called by the server and kicks everything in gear.\n All it does is display the connect screen.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -276,7 +276,7 @@ indentation.</p>
<dl class="py attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = [':y', ':s', ':r', ':uu', ':echo', ':p', ':&lt;', ':&gt;', ':wq', ':q', ':DD', ':S', ':f', ':=', ':UU', ':I', ':dw', ':::', ':dd', ':j', ':', ':!', ':h', ':x', ':i', ':u', ':fd', ':w', '::', ':fi', ':q!', ':A']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = [':uu', ':S', ':fd', ':i', ':p', ':&lt;', ':dd', ':r', ':::', ':I', ':fi', ':&gt;', ':h', ':A', ':y', ':DD', ':echo', ':s', ':q', ':', ':wq', ':UU', ':dw', ':!', ':w', '::', ':=', ':q!', ':j', ':x', ':f', ':u']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -304,7 +304,7 @@ efficient presentation.</p>
<dl class="py attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': ':y :s :r :uu :echo :p :&lt; :&gt; :wq :q :DD :S :f := :UU :I :dw ::: :dd :j : :! :h :x :i :u :fd :w :: :fi :q! :A', 'category': 'general', 'key': ':editor_command_group', 'no_prefix': ' :y :s :r :uu :echo :p :&lt; :&gt; :wq :q :DD :S :f := :UU :I :dw ::: :dd :j : :! :h :x :i :u :fd :w :: :fi :q! :A', 'tags': '', 'text': '\n Commands for the editor\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': ':uu :S :fd :i :p :&lt; :dd :r ::: :I :fi :&gt; :h :A :y :DD :echo :s :q : :wq :UU :dw :! :w :: := :q! :j :x :f :u', 'category': 'general', 'key': ':editor_command_group', 'no_prefix': ' :uu :S :fd :i :p :&lt; :dd :r ::: :I :fi :&gt; :h :A :y :DD :echo :s :q : :wq :UU :dw :! :w :: := :q! :j :x :f :u', 'tags': '', 'text': '\n Commands for the editor\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -946,7 +946,7 @@ single question.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmenu.CmdYesNoQuestion.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['a', 'y', 'n', 'no', 'abort', 'yes', '__nomatch_command']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['n', 'no', 'a', '__nomatch_command', 'y', 'abort', 'yes']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -972,7 +972,7 @@ single question.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'a y n no abort yes __nomatch_command', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' a y n no abort yes __nomatch_command', 'tags': '', 'text': '\n Handle a prompt for yes or no. Press [return] for the default choice.\n\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'n no a __nomatch_command y abort yes', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' n no a __nomatch_command y abort yes', 'tags': '', 'text': '\n Handle a prompt for yes or no. Press [return] for the default choice.\n\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -77,7 +77,7 @@ the <strong>caller.msg()</strong> construct every time the page is updated.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmore.CmdMore.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['a', 'end', 'p', 'top', 'quit', 'n', 't', 'next', 'previous', 'e', 'abort', 'q']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['n', 'p', 'quit', 'a', 'e', 'end', 'previous', 'top', 'q', 't', 'abort', 'next']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -103,7 +103,7 @@ the <strong>caller.msg()</strong> construct every time the page is updated.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmore.CmdMore.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'a end p top quit n t next previous e abort q', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' a end p top quit n t next previous e abort q', 'tags': '', 'text': '\n Manipulate the text paging. Catch no-input with aliases.\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'n p quit a e end previous top q t abort next', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' n p quit a e end previous top q t abort next', 'tags': '', 'text': '\n Manipulate the text paging. Catch no-input with aliases.\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -42,6 +42,29 @@
<section id="module-evennia.utils.test_resources">
<span id="evennia-utils-test-resources"></span><h1>evennia.utils.test_resources<a class="headerlink" href="#module-evennia.utils.test_resources" title="Permalink to this headline"></a></h1>
<p>Various helper resources for writing unittests.</p>
<p>Classes for testing Evennia core:</p>
<ul class="simple">
<li><p><strong>BaseEvenniaTestCase</strong> - no default objects, only enforced default settings</p></li>
<li><p><strong>BaseEvenniaTest</strong> - all default objects, enforced default settings</p></li>
<li><p><strong>BaseEvenniaCommandTest</strong> - for testing Commands, enforced default settings</p></li>
</ul>
<p>Classes for testing game folder content:</p>
<ul class="simple">
<li><dl class="simple">
<dt><strong>EvenniaTestCase</strong> - no default objects, using gamedir settings (identical to</dt><dd><p>standard Python TestCase)</p>
</dd>
</dl>
</li>
<li><p><strong>EvenniaTest</strong> - all default objects, using gamedir settings</p></li>
<li><p><strong>EvenniaCommandTest</strong> - for testing game folder commands, using gamedir settings</p></li>
</ul>
<p>Other:</p>
<ul class="simple">
<li><p><strong>EvenniaTestMixin</strong> - A class mixin for creating the test environment objects, for
making custom tests.</p></li>
<li><p><strong>EvenniaCommandMixin</strong> - A class mixin that adds support for command testing with the .call()
helper. Used by the command-test classes, but can be used for making a customt test class.</p></li>
</ul>
<dl class="py function">
<dt id="evennia.utils.test_resources.mockdelay">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">mockdelay</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timedelay</span></em>, <em class="sig-param"><span class="n">callback</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#mockdelay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.mockdelay" title="Permalink to this definition"></a></dt>
@ -171,12 +194,129 @@ loaded once).</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaCommandTestMixin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaCommandTestMixin</code><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTestMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Mixin to add to a test in order to provide the <strong>.call</strong> helper for
testing the execution and returns of a command.</p>
<p>Tests a Command by running it and comparing what messages it sends with
expected values. This tests without actually spinning up the cmdhandler
for every test, which is more controlled.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">commands.echo</span> <span class="kn">import</span> <span class="n">CmdEcho</span>
<span class="k">class</span> <span class="nc">MyCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_echo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">MyCommand</span><span class="p">(),</span> <span class="s2">&quot;hello world!&quot;</span><span class="p">,</span>
<span class="s2">&quot;You hear your echo: &#39;Hello world!&#39;&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt id="evennia.utils.test_resources.EvenniaCommandTestMixin.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdobj</span></em>, <em class="sig-param"><span class="n">input_args</span></em>, <em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdset</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">noansi</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">caller</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">receiver</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdstring</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">raw_string</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTestMixin.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTestMixin.call" title="Permalink to this definition"></a></dt>
<dd><p>Test a command by assigning all the needed properties to a cmdobj and
running the sequence. The resulting <strong>.msg</strong> calls will be mocked and
the text= calls to them compared to a expected output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cmdobj</strong> (<a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><em>Command</em></a>) The command object to use.</p></li>
<li><p><strong>input_args</strong> (<em>str</em>) This should be the full input the Command should
see, such as look here. This will become <strong>.args</strong> for the Command
instance to parse.</p></li>
<li><p><strong>msg</strong> (<em>str</em><em> or </em><em>dict</em><em>, </em><em>optional</em>) This is the expected return value(s)
returned through <strong>caller.msg(text=…)</strong> calls in the command. If a string, the
receiver is controlled with the <strong>receiver</strong> kwarg (defaults to <strong>caller</strong>).
If this is a <strong>dict</strong>, it is a mapping
<strong>{receiver1: “expected1”, receiver2: “expected2”,…}</strong> and <strong>receiver</strong> is
ignored. The message(s) are compared with the actual messages returned
to the receiver(s) as the Command runs. Each check uses <strong>.startswith</strong>,
so you can choose to only include the first part of the
returned message if thats enough to verify a correct result. EvMenu
decorations (like borders) are stripped and should not be included. This
should also not include color tags unless <strong>noansi=False</strong>.
If the command returns texts in multiple separate <strong>.msg</strong>-
calls to a receiver, separate these with <strong>|</strong> if <strong>noansi=True</strong>
(default) and <strong>||</strong> if <strong>noansi=False</strong>. If no <strong>msg</strong> is given (<strong>None</strong>),
then no automatic comparison will be done.</p></li>
<li><p><strong>cmdset</strong> (<em>str</em><em>, </em><em>optional</em>) If given, make <strong>.cmdset</strong> available on the Command
instance as it runs. While <strong>.cmdset</strong> is normally available on the
Command instance by default, this is usually only used by
commands that explicitly operates/displays cmdsets, like
<strong>examine</strong>.</p></li>
<li><p><strong>noansi</strong> (<em>str</em><em>, </em><em>optional</em>) By default the color tags of the <strong>msg</strong> is
ignored, this makes them significant. If unset, <strong>msg</strong> must contain
the same color tags as the actual return message.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) By default <strong>self.char1</strong> is used as the
command-caller (the <strong>.caller</strong> property on the Command). This allows to
execute with another caller, most commonly an Account.</p></li>
<li><p><strong>receiver</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) This is the object to receive the
return messages we want to test. By default this is the same as <strong>caller</strong>
(which in turn defaults to is <strong>self.char1</strong>). Note that if <strong>msg</strong> is
a <strong>dict</strong>, this is ignored since the receiver is already specified there.</p></li>
<li><p><strong>cmdstring</strong> (<em>str</em><em>, </em><em>optional</em>) Normally this is the Commands <strong>key</strong>.
This allows for tweaking the <strong>.cmdname</strong> property of the
Command**. This isb used for commands with multiple aliases,
where the command explicitly checs which alias was used to
determine its functionality.</p></li>
<li><p><strong>obj</strong> (<em>str</em><em>, </em><em>optional</em>) This sets the <strong>.obj</strong> property of the Command - the
object on which the Command sits. By default this is the same as <strong>caller</strong>.
This can be used for testing on-object Command interactions.</p></li>
<li><p><strong>inputs</strong> (<em>list</em><em>, </em><em>optional</em>) A list of strings to pass to functions that pause to
take input from the user (normally using <strong>&#64;interactive</strong> and
<strong>ret = yield(question)</strong> or <strong>evmenu.get_input</strong>). Each element of the
list will be passed into the command as if the user wrote that at the prompt.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em><em>, </em><em>optional</em>) Normally the <strong>.raw_string</strong> property is set as
a combination of your <strong>key/cmdname</strong> and <strong>input_args</strong>. This allows
direct control of what this is, for example for testing edge cases
or malformed inputs.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>str or dict</em> </p>
<dl class="simple">
<dt>The message sent to <strong>receiver</strong>, or a dict of</dt><dd><p><strong>{receiver: “msg”, …}</strong> if multiple are given. This is usually
only used with <strong>msg=None</strong> to do the validation externally.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>AssertionError</strong> If the returns of <strong>.msg</strong> calls (tested with <strong>.startswith</strong>) does not
match <strong>expected_input</strong>.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>As part of the tests, all methods of the Command will be called in
the proper order:</p>
<ul class="simple">
<li><p>cmdobj.at_pre_cmd()</p></li>
<li><p>cmdobj.parse()</p></li>
<li><p>cmdobj.func()</p></li>
<li><p>cmdobj.at_post_cmd()</p></li>
</ul>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.BaseEvenniaTestCase">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">BaseEvenniaTestCase</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#BaseEvenniaTestCase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.BaseEvenniaTestCase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.test.testcases.TestCase</span></code></p>
<p>Base test (with no default objects) but with
enforced default settings.</p>
<p>Base test (with no default objects) but with enforced default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaTestCase">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaTestCase</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaTestCase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTestCase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.test.testcases.TestCase</span></code></p>
<p>For use with gamedir settings; Just like the normal test case, only for naming consistency.</p>
</dd></dl>
<dl class="py class">
@ -225,6 +365,21 @@ and settings from your game folder.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.BaseEvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">BaseEvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#BaseEvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.BaseEvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.test_resources.BaseEvenniaTest" title="evennia.utils.test_resources.BaseEvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="evennia.utils.test_resources.EvenniaCommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaCommandTestMixin</span></code></a></p>
<p>Commands only using the default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="evennia.utils.test_resources.EvenniaCommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaCommandTestMixin</span></code></a></p>
<p>Parent class to inherit from - makes tests use your own
classes and settings in mygame.</p>
</dd></dl>
</section>

View file

@ -1285,6 +1285,8 @@
<li><a href="api/evennia.web.website.forms.html#evennia.web.website.forms.ObjectForm.base_fields">(evennia.web.website.forms.ObjectForm attribute)</a>
</li>
</ul></li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest">BaseEvenniaCommandTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest">BaseEvenniaTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTestCase">BaseEvenniaTestCase (class in evennia.utils.test_resources)</a>
@ -1417,10 +1419,10 @@
</li>
<li><a href="api/evennia.utils.idmapper.models.html#evennia.utils.idmapper.models.cache_size">cache_size() (in module evennia.utils.idmapper.models)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin.call">call() (evennia.commands.default.tests.CommandTestMixin method)</a>
<li><a href="api/evennia.scripts.taskhandler.html#evennia.scripts.taskhandler.TaskHandlerTask.call">call() (evennia.scripts.taskhandler.TaskHandlerTask method)</a>, <a href="api/evennia.scripts.taskhandler.html#id3">[1]</a>
<ul>
<li><a href="api/evennia.scripts.taskhandler.html#evennia.scripts.taskhandler.TaskHandlerTask.call">(evennia.scripts.taskhandler.TaskHandlerTask method)</a>, <a href="api/evennia.scripts.taskhandler.html#id3">[1]</a>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call">(evennia.utils.test_resources.EvenniaCommandTestMixin method)</a>
</li>
</ul></li>
<li><a href="api/evennia.server.sessionhandler.html#evennia.server.sessionhandler.ServerSessionHandler.call_inputfuncs">call_inputfuncs() (evennia.server.sessionhandler.ServerSessionHandler method)</a>
@ -1750,11 +1752,11 @@
<li><a href="api/evennia.commands.default.building.html#evennia.commands.default.building.CmdLink">CmdLink (class in evennia.commands.default.building)</a>
</li>
<li><a href="api/evennia.commands.default.building.html#evennia.commands.default.building.CmdListCmdSets">CmdListCmdSets (class in evennia.commands.default.building)</a>
</li>
<li><a href="api/evennia.commands.default.building.html#evennia.commands.default.building.CmdLock">CmdLock (class in evennia.commands.default.building)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/evennia.commands.default.building.html#evennia.commands.default.building.CmdLock">CmdLock (class in evennia.commands.default.building)</a>
</li>
<li><a href="api/evennia.commands.default.general.html#evennia.commands.default.general.CmdLook">CmdLook (class in evennia.commands.default.general)</a>
</li>
<li><a href="api/evennia.utils.evmore.html#evennia.utils.evmore.CmdMore">CmdMore (class in evennia.utils.evmore)</a>
@ -1941,10 +1943,6 @@
<li><a href="api/evennia.server.portal.amp.html#evennia.server.portal.amp.MsgStatus.commandName">(evennia.server.portal.amp.MsgStatus attribute)</a>
</li>
</ul></li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTest">CommandTest (class in evennia.commands.default.tests)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin">CommandTestMixin (class in evennia.commands.default.tests)</a>
</li>
<li><a href="api/evennia.comms.managers.html#evennia.comms.managers.CommError">CommError</a>
</li>
<li><a href="api/evennia.server.portal.amp.html#evennia.server.portal.amp.Compressed">Compressed (class in evennia.server.portal.amp)</a>
@ -3889,7 +3887,9 @@
</ul></li>
<li><a href="api/evennia.server.evennia_launcher.html#evennia.server.evennia_launcher.evennia_version">evennia_version() (in module evennia.server.evennia_launcher)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest">EvenniaCommandTest (class in evennia.commands.default.tests)</a>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTest">EvenniaCommandTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin">EvenniaCommandTestMixin (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.web.website.forms.html#evennia.web.website.forms.EvenniaForm">EvenniaForm (class in evennia.web.website.forms)</a>
</li>
@ -3904,6 +3904,8 @@
<li><a href="api/evennia.server.webserver.html#evennia.server.webserver.EvenniaReverseProxyResource">EvenniaReverseProxyResource (class in evennia.server.webserver)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest">EvenniaTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestCase">EvenniaTestCase (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin">EvenniaTestMixin (class in evennia.utils.test_resources)</a>
</li>

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0eb0e195898fe47f6bf6f1fa5714cd40
config: 8fe15c3058c7b2a0bccd9819f0828688
tags: 645f666f9bcd5a90fca523b33c5a78b7

View file

@ -69,118 +69,195 @@ how many tests were run and how long it took. If something went wrong you will g
If you contribute to Evennia, this is a useful sanity check to see you havent introduced an
unexpected bug.</p>
</section>
<section id="running-tests-with-custom-settings-file">
<h2>Running tests with custom settings file<a class="headerlink" href="#running-tests-with-custom-settings-file" title="Permalink to this headline"></a></h2>
<p>If you have implemented your own tests for your game (see below) you can run them from your game dir
<section id="running-tests-for-your-game-dir">
<h2>Running tests for your game dir<a class="headerlink" href="#running-tests-for-your-game-dir" title="Permalink to this headline"></a></h2>
<p>If you have implemented your own tests for your game you can run them from your game dir
with</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test .
</pre></div>
</div>
<p>The period (<code class="docutils literal notranslate"><span class="pre">.</span></code>) means to run all tests found in the current directory and all subdirectories. You
could also specify, say, <code class="docutils literal notranslate"><span class="pre">typeclasses</span></code> or <code class="docutils literal notranslate"><span class="pre">world</span></code> if you wanted to just run tests in those subdirs.</p>
<p>Those tests will all be run using the default settings. To run the tests with your own settings file
you must use the <code class="docutils literal notranslate"><span class="pre">--settings</span></code> option:</p>
<p>An important thing to note is that those tests will all be run using the <em>default Evennia settings</em>.
To run the tests with your own settings file you must use the <code class="docutils literal notranslate"><span class="pre">--settings</span></code> option:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">--settings</span></code> option of Evennia takes a file name in the <code class="docutils literal notranslate"><span class="pre">mygame/server/conf</span></code> folder. It is
normally used to swap settings files for testing and development. In combination with <code class="docutils literal notranslate"><span class="pre">test</span></code>, it
forces Evennia to use this settings file over the default one.</p>
<p>You can also test specific things by giving their path</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .world.tests.YourTest
</pre></div>
</div>
</section>
<section id="writing-new-tests">
<h2>Writing new tests<a class="headerlink" href="#writing-new-tests" title="Permalink to this headline"></a></h2>
<p>Evennias test suite makes use of Django unit test system, which in turn relies on Pythons
<em>unittest</em> module.</p>
<blockquote>
<div><p>If you want to help out writing unittests for Evennia, take a look at Evennias <a class="reference external" href="https://coveralls.io/github/evennia/evennia">coveralls.io
page</a>. There you see which modules have any form of
test coverage and which does not.</p>
</div></blockquote>
<p>To make the test runner find the tests, they must be put in a module named <code class="docutils literal notranslate"><span class="pre">test*.py</span></code> (so <code class="docutils literal notranslate"><span class="pre">test.py</span></code>,
<code class="docutils literal notranslate"><span class="pre">tests.py</span></code> etc). Such a test module will be found wherever it is in the package. It can be a good
idea to look at some of Evennias <code class="docutils literal notranslate"><span class="pre">tests.py</span></code> modules to see how they look.</p>
<p>Inside a testing file, a <code class="docutils literal notranslate"><span class="pre">unittest.TestCase</span></code> class is used to test a single aspect or component in
various ways. Each test case contains one or more <em>test methods</em> - these define the actual tests to
run. You can name the test methods anything you want as long as the name starts with “<code class="docutils literal notranslate"><span class="pre">test_</span></code>”.
Your <code class="docutils literal notranslate"><span class="pre">TestCase</span></code> class can also have a method <code class="docutils literal notranslate"><span class="pre">setUp()</span></code>. This is run before each test, setting up and
storing whatever preparations the test methods need. Conversely, a <code class="docutils literal notranslate"><span class="pre">tearDown()</span></code> method can
optionally do cleanup after each test.</p>
<p>To test the results, you use special methods of the <code class="docutils literal notranslate"><span class="pre">TestCase</span></code> class. Many of those start with
<code class="docutils literal notranslate"><span class="pre">assert</span></code>”, such as <code class="docutils literal notranslate"><span class="pre">assertEqual</span></code> or <code class="docutils literal notranslate"><span class="pre">assertTrue</span></code>.</p>
<p>Example of a <code class="docutils literal notranslate"><span class="pre">TestCase</span></code> class:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="kn">import</span> <span class="nn">unittest</span>
<p>Inside the module you need to put a class inheriting (at any distance) from <code class="docutils literal notranslate"><span class="pre">unittest.TestCase</span></code>. Each
method on that class that starts with <code class="docutils literal notranslate"><span class="pre">test_</span></code> will be run separately as a unit test. There
are two special, optional methods <code class="docutils literal notranslate"><span class="pre">setUp</span></code> and <code class="docutils literal notranslate"><span class="pre">tearDown</span></code> that will (if you define them) run before
<em>every</em> test. This can be useful for setting up and deleting things.</p>
<p>To actually test things, you use special <code class="docutils literal notranslate"><span class="pre">assert...</span></code> methods on the class. Most common on is
<code class="docutils literal notranslate"><span class="pre">assertEqual</span></code>, which makes sure a result is what you expect it to be.</p>
<p>Heres an example of the principle. Lets assume you put this in <code class="docutils literal notranslate"><span class="pre">mygame/world/tests.py</span></code>
and want to test a function in <code class="docutils literal notranslate"><span class="pre">mygame/world/myfunctions.py</span></code></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="c1"># in a module tests.py somewhere i your game dir</span>
<span class="kn">import</span> <span class="nn">unittest</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="c1"># the function we want to test</span>
<span class="kn">from</span> <span class="nn">mypath</span> <span class="kn">import</span> <span class="n">myfunc</span>
<span class="kn">from</span> <span class="nn">.myfunctions</span> <span class="kn">import</span> <span class="n">myfunc</span>
<span class="k">class</span> <span class="nc">TestObj</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
<span class="s2">&quot;This tests a function myfunc.&quot;</span>
<span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;done before every of the test_ * methods below&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="s2">&quot;mytestobject&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">tearDown</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;done after every test_* method below &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
<span class="k">def</span> <span class="nf">test_return_value</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="s2">&quot;test method. Makes sure return value is as expected.&quot;</span>
<span class="n">expected_return</span> <span class="o">=</span> <span class="s2">&quot;This is me being nice.&quot;</span>
<span class="n">actual_return</span> <span class="o">=</span> <span class="n">myfunc</span><span class="p">()</span>
<span class="sd">&quot;&quot;&quot;test method. Makes sure return value is as expected.&quot;&quot;&quot;</span>
<span class="n">actual_return</span> <span class="o">=</span> <span class="n">myfunc</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">)</span>
<span class="n">expected_return</span> <span class="o">=</span> <span class="s2">&quot;This is the good object &#39;mytestobject&#39;.&quot;</span>
<span class="c1"># test</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">expected_return</span><span class="p">,</span> <span class="n">actual_return</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test_alternative_call</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="s2">&quot;test method. Calls with a keyword argument.&quot;</span>
<span class="n">expected_return</span> <span class="o">=</span> <span class="s2">&quot;This is me being baaaad.&quot;</span>
<span class="n">actual_return</span> <span class="o">=</span> <span class="n">myfunc</span><span class="p">(</span><span class="n">bad</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;test method. Calls with a keyword argument.&quot;&quot;&quot;</span>
<span class="n">actual_return</span> <span class="o">=</span> <span class="n">myfunc</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">,</span> <span class="n">bad</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">expected_return</span> <span class="o">=</span> <span class="s2">&quot;This is the baaad object &#39;mytestobject&#39;.&quot;</span>
<span class="c1"># test</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">expected_return</span><span class="p">,</span> <span class="n">actual_return</span><span class="p">)</span>
</pre></div>
</div>
<p>You might also want to read the <a class="reference external" href="https://docs.python.org/library/unittest.html">documentation for the unittest
module</a>.</p>
<section id="using-the-evenniatest-class">
<h3>Using the EvenniaTest class<a class="headerlink" href="#using-the-evenniatest-class" title="Permalink to this headline"></a></h3>
<p>Evennia offers a custom TestCase, the <code class="docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code> class. This class
initiates a range of useful properties on themselves for testing Evennia systems. Examples are
<code class="docutils literal notranslate"><span class="pre">.account</span></code> and <code class="docutils literal notranslate"><span class="pre">.session</span></code> representing a mock connected Account and its Session and <code class="docutils literal notranslate"><span class="pre">.char1</span></code> and
<code class="docutils literal notranslate"><span class="pre">char2</span></code> representing Characters complete with a location in the test database. These are all useful
when testing Evennia system requiring any of the default Evennia typeclasses as inputs. See the full
definition of the <code class="docutils literal notranslate"><span class="pre">EvenniaTest</span></code> class in
<a class="reference external" href="https://github.com/evennia/evennia/blob/master/evennia/utils/test_resources.py">evennia/utils/test_resources.py</a>.</p>
<p>To test this, run</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .
</pre></div>
</div>
<p>to run the entire test module</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings setings.py .world.tests
</pre></div>
</div>
<p>or a specific class:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .world.tests.TestObj
</pre></div>
</div>
<p>You can also run a specific test:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia test --settings settings.py .world.tests.TestObj.test_alternative_call
</pre></div>
</div>
<p>You might also want to read the <a class="reference external" href="https://docs.python.org/library/unittest.html">Python documentation for the unittest module</a>.</p>
</section>
<section id="using-the-evennia-testing-classes">
<h2>Using the Evennia testing classes<a class="headerlink" href="#using-the-evennia-testing-classes" title="Permalink to this headline"></a></h2>
<p>Evennia offers many custom testing classes that helps with testing Evennia features.
They are all found in <a class="reference internal" href="../api/evennia.utils.test_resources.html#evennia-utils-test-resources"><span class="std std-ref">evennia.utils.test_resources</span></a>. Note that
these classes implement the <code class="docutils literal notranslate"><span class="pre">setUp</span></code> and <code class="docutils literal notranslate"><span class="pre">tearDown</span></code> already, so if you want to add stuff in them
yourself you should remember to use e.g. <code class="docutils literal notranslate"><span class="pre">super().setUp()</span></code> in your code.</p>
<section id="classes-for-testing-your-game-dir">
<h3>Classes for testing your game dir<a class="headerlink" href="#classes-for-testing-your-game-dir" title="Permalink to this headline"></a></h3>
<p>These all use whatever setting you pass to them and works well for testing code in your game dir.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EvenniaTest</span></code> - this sets up a full object environment for your test. All the created entities
can be accesses as properties on the class:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">.account</span></code> - A fake <a class="reference internal" href="../api/evennia.accounts.accounts.html#evennia.accounts.accounts.DefaultAccount" title="evennia.accounts.accounts.DefaultAccount"><span class="xref myst py py-class">Account</span></a> named “TestAccount”.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.account2</span></code> - Another account named “TestAccount2”</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">char1</span></code> - A <a class="reference internal" href="../api/evennia.objects.objects.html#evennia.objects.objects.DefaultCharacter" title="evennia.objects.objects.DefaultCharacter"><span class="xref myst py py-class">Character</span></a> linked to <code class="docutils literal notranslate"><span class="pre">.account</span></code>, named <code class="docutils literal notranslate"><span class="pre">Char</span></code>.
This has Developer permissions but is not a superuser.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.char2</span></code> - Another character linked to <code class="docutils literal notranslate"><span class="pre">account</span></code>, named <code class="docutils literal notranslate"><span class="pre">Char2</span></code>. This has base permissions (player).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.obj1</span></code> - A regular <a class="reference internal" href="../api/evennia.objects.objects.html#evennia.objects.objects.DefaultObject" title="evennia.objects.objects.DefaultObject"><span class="xref myst py py-class">Object</span></a> named “Obj”.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.obj2</span></code> - Another object named “Obj2”.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.room1</span></code> - A <a class="reference internal" href="../api/evennia.objects.objects.html#evennia.objects.objects.DefaultRoom" title="evennia.objects.objects.DefaultRoom"><span class="xref myst py py-class">Room</span></a> named “Room”. Both characters and both
objects are located inside this room. It has a description of “room_desc”.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.room2</span></code> - Another room named “Room2”. It is empty and has no set description.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.exit</span></code> - An exit named “out” that leads from <code class="docutils literal notranslate"><span class="pre">.room1</span></code> to <code class="docutils literal notranslate"><span class="pre">.room2</span></code>.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.script</span></code> - A <a class="reference internal" href="../api/evennia.scripts.scripts.html#evennia.scripts.scripts.DefaultScript" title="evennia.scripts.scripts.DefaultScript"><span class="xref myst py py-class">Script</span></a> named “Script”. Its an inert script
without a timing component.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.session</span></code> - A fake <a class="reference internal" href="../api/evennia.server.serversession.html#evennia.server.serversession.ServerSession" title="evennia.server.serversession.ServerSession"><span class="xref myst py py-class">Session</span></a> that mimics a player
connecting to the game. It is used by <code class="docutils literal notranslate"><span class="pre">.account1</span></code> and has a sessid of 1.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">EvenniaCommandTest</span></code> - has the same environment like <code class="docutils literal notranslate"><span class="pre">EvenniaTest</span></code> but also adds a special
<a class="reference internal" href="../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call" title="evennia.utils.test_resources.EvenniaCommandTestMixin.call"><span class="xref myst py py-meth">.call()</span></a> method specifically for
testing Evennia <a class="reference internal" href="../Components/Commands.html"><span class="doc std std-doc">Commands</span></a>. It allows you to compare what the command <em>actually</em>
returns to the player with what you expect. Read the <code class="docutils literal notranslate"><span class="pre">call</span></code> api doc for more info.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">EvenniaTestCase</span></code> - This is identical to the regular Python <code class="docutils literal notranslate"><span class="pre">TestCase</span></code> class, its
just there for naming symmetry with <code class="docutils literal notranslate"><span class="pre">BaseEvenniaTestCase</span></code> below.</p></li>
</ul>
<p>Heres an example of using <code class="docutils literal notranslate"><span class="pre">EvenniaTest</span></code></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># in a test module</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">EvenniaTest</span>
<span class="k">class</span> <span class="nc">TestObject</span><span class="p">(</span><span class="n">BaseEvenniaTest</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_object_search</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># char1 and char2 are both created in room1</span>
<span class="k">class</span> <span class="nc">TestObject</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Remember that the testing class creates char1 and char2 inside room1 ...&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">test_object_search_character</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Check that char1 can search for char2 by name&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">char2</span><span class="o">.</span><span class="n">key</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">char2</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test_location_search</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Check so that char1 can find the current location by name&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">location</span><span class="o">.</span><span class="n">key</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">location</span><span class="p">)</span>
<span class="c1"># ...</span>
</pre></div>
</div>
</section>
<section id="testing-in-game-commands">
<h3>Testing in-game Commands<a class="headerlink" href="#testing-in-game-commands" title="Permalink to this headline"></a></h3>
<p>In-game Commands are a special case. Tests for the default commands are put in
<code class="docutils literal notranslate"><span class="pre">evennia/commands/default/tests.py</span></code>. This uses a custom <code class="docutils literal notranslate"><span class="pre">CommandTest</span></code> class that inherits from
<code class="docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code> described above. <code class="docutils literal notranslate"><span class="pre">CommandTest</span></code> supplies extra convenience
functions for executing commands and check that their return values (calls of <code class="docutils literal notranslate"><span class="pre">msg()</span></code> returns
expected values. It uses Characters and Sessions generated on the <code class="docutils literal notranslate"><span class="pre">EvenniaTest</span></code> class to call each
class).</p>
<p>Each command tested should have its own <code class="docutils literal notranslate"><span class="pre">TestCase</span></code> class. Inherit this class from the <code class="docutils literal notranslate"><span class="pre">CommandTest</span></code>
class in the same module to get access to the command-specific utilities mentioned.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">CommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default</span> <span class="kn">import</span> <span class="n">general</span>
<span class="k">class</span> <span class="nc">TestSet</span><span class="p">(</span><span class="n">CommandTest</span><span class="p">):</span>
<span class="s2">&quot;tests the look command by simple call, using Char2 as a target&quot;</span>
<span class="k">def</span> <span class="nf">test_mycmd_char</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdLook</span><span class="p">(),</span> <span class="s2">&quot;Char2&quot;</span><span class="p">,</span> <span class="s2">&quot;Char2(#7)&quot;</span><span class="p">)</span>
<p>This example tests a custom command.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">commands</span> <span class="kn">import</span> <span class="n">command</span> <span class="k">as</span> <span class="n">mycommand</span>
<span class="k">class</span> <span class="nc">TestSet</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="s2">&quot;tests the look command by simple call, using Char2 as a target&quot;</span>
<span class="k">def</span> <span class="nf">test_mycmd_char</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">mycommand</span><span class="o">.</span><span class="n">CmdMyLook</span><span class="p">(),</span> <span class="s2">&quot;Char2&quot;</span><span class="p">,</span> <span class="s2">&quot;Char2(#7)&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test_mycmd_room</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="s2">&quot;tests the look command by simple call, with target as room&quot;</span>
<span class="k">def</span> <span class="nf">test_mycmd_room</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdLook</span><span class="p">(),</span> <span class="s2">&quot;Room&quot;</span><span class="p">,</span>
<span class="s2">&quot;Room(#1)</span><span class="se">\n</span><span class="s2">room_desc</span><span class="se">\n</span><span class="s2">Exits: out(#3)</span><span class="se">\n</span><span class="s2">&quot;</span>
<span class="s2">&quot;You see: Obj(#4), Obj2(#5), Char2(#7)&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">mycommand</span><span class="o">.</span><span class="n">CmdMyLook</span><span class="p">(),</span> <span class="s2">&quot;Room&quot;</span><span class="p">,</span>
<span class="s2">&quot;Room(#1)</span><span class="se">\n</span><span class="s2">room_desc</span><span class="se">\n</span><span class="s2">Exits: out(#3)</span><span class="se">\n</span><span class="s2">&quot;</span>
<span class="s2">&quot;You see: Obj(#4), Obj2(#5), Char2(#7)&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>When using <code class="docutils literal notranslate"><span class="pre">.call</span></code>, you dont need to specify the entire string; you can just give the beginning
of it and if it matches, thats enough. Use <code class="docutils literal notranslate"><span class="pre">\n</span></code> to denote line breaks and (this is a special for
the <code class="docutils literal notranslate"><span class="pre">.call</span></code> helper), <code class="docutils literal notranslate"><span class="pre">||</span></code> to indicate multiple uses of <code class="docutils literal notranslate"><span class="pre">.msg()</span></code> in the Command. The <code class="docutils literal notranslate"><span class="pre">.call</span></code> helper
has a lot of arguments for mimicing different ways of calling a Command, so make sure to
<a class="reference internal" href="../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call" title="evennia.utils.test_resources.EvenniaCommandTestMixin.call"><span class="xref myst py py-meth">read the API docs for .call()</span></a>.</p>
</section>
<section id="classes-for-testing-evennia-core">
<h3>Classes for testing Evennia core<a class="headerlink" href="#classes-for-testing-evennia-core" title="Permalink to this headline"></a></h3>
<p>These are used for testing Evennia itself. They provide the same resources as the classes
above but enforce Evennias default settings found in <code class="docutils literal notranslate"><span class="pre">evennia/settings_default.py</span></code>, ignoring
any settings changes in your game dir.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">BaseEvenniaTest</span></code> - all the default objects above but with enforced default settings</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">BaseEvenniaCommandTest</span></code> - for testing Commands, but with enforced default settings</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">BaseEvenniaTestCase</span></code> - no default objects, only enforced default settings</p></li>
</ul>
<p>There are also two special mixin classes. These are uses in the classes above, but may also
be useful if you want to mix your own testing classes:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">EvenniaTestMixin</span></code> - A class mixin that creates all test environment objects.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">EvenniaCommandMixin</span></code> - A class mixin that adds the <code class="docutils literal notranslate"><span class="pre">.call()</span></code> Command-tester helper.</p></li>
</ul>
<p>If you want to help out writing unittests for Evennia, take a look at Evennias <a class="reference external" href="https://coveralls.io/github/evennia/evennia">coveralls.io
page</a>. There you see which modules have any form of
test coverage and which does not. All help is appreciated!</p>
</section>
</section>
<section id="unit-testing-contribs-with-custom-models">
<h3>Unit testing contribs with custom models<a class="headerlink" href="#unit-testing-contribs-with-custom-models" title="Permalink to this headline"></a></h3>
<h2>Unit testing contribs with custom models<a class="headerlink" href="#unit-testing-contribs-with-custom-models" title="Permalink to this headline"></a></h2>
<p>A special case is if you were to create a contribution to go to the <code class="docutils literal notranslate"><span class="pre">evennia/contrib</span></code> folder that
uses its <a class="reference internal" href="../Concepts/New-Models.html"><span class="doc std std-doc">own database models</span></a>. The problem with this is that Evennia (and Django) will
only recognize models in <code class="docutils literal notranslate"><span class="pre">settings.INSTALLED_APPS</span></code>. If a user wants to use your contrib, they will
@ -243,15 +320,8 @@ testing#503435) is currently untested! Please report your findings.</p>
</pre></div>
</div>
</section>
<section id="a-note-on-adding-new-tests">
<h3>A note on adding new tests<a class="headerlink" href="#a-note-on-adding-new-tests" title="Permalink to this headline"></a></h3>
<p>Having an extensive tests suite is very important for avoiding code degradation as Evennia is
developed. Only a small fraction of the Evennia codebase is covered by test suites at this point.
Writing new tests is not hard, its more a matter of finding the time to do so. So adding new tests
is really an area where everyone can contribute, also with only limited Python skills.</p>
</section>
<section id="a-note-on-making-the-test-runner-faster">
<h3>A note on making the test runner faster<a class="headerlink" href="#a-note-on-making-the-test-runner-faster" title="Permalink to this headline"></a></h3>
<h2>A note on making the test runner faster<a class="headerlink" href="#a-note-on-making-the-test-runner-faster" title="Permalink to this headline"></a></h2>
<p>If you have custom models with a large number of migrations, creating the test database can take a
very long time. If you dont require migrations to run for your tests, you can disable them with the
django-test-without-migrations package. To install it, simply:</p>
@ -270,152 +340,6 @@ django-test-without-migrations package. To install it, simply:</p>
</pre></div>
</div>
</section>
</section>
<section id="testing-for-game-development-mini-tutorial">
<h2>Testing for Game development (mini-tutorial)<a class="headerlink" href="#testing-for-game-development-mini-tutorial" title="Permalink to this headline"></a></h2>
<p>Unit testing can be of paramount importance to game developers. When starting with a new game, it is
recommended to look into unit testing as soon as possible; an already huge game is much harder to
write tests for. The benefits of testing a game arent different from the ones regarding library
testing. For example it is easy to introduce bugs that affect previously working code. Testing is
there to ensure your project behaves the way it should and continue to do so.</p>
<p>If you have never used unit testing (with Python or another language), you might want to check the
<a class="reference external" href="https://docs.python.org/2/library/unittest.html">official Python documentation about unit testing</a>,
particularly the first section dedicated to a basic example.</p>
<section id="basic-testing-using-evennia">
<h3>Basic testing using Evennia<a class="headerlink" href="#basic-testing-using-evennia" title="Permalink to this headline"></a></h3>
<p>Evennias test runner can be used to launch tests in your game directory (lets call it mygame).
Evennias test runner does a few useful things beyond the normal Python unittest module:</p>
<ul class="simple">
<li><p>It creates and sets up an empty database, with some useful objects (accounts, characters and
rooms, among others).</p></li>
<li><p>It provides simple ways to test commands, which can be somewhat tricky at times, if not tested
properly.</p></li>
</ul>
<p>Therefore, you should use the command-line to execute the test runner, while specifying your own
game directories (not the one containing evennia). Go to your game directory (referred as mygame
in this section) and execute the test runner:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>evennia --settings settings.py test commands
</pre></div>
</div>
<p>This command will execute Evennias test runner using your own settings file. It will set up a dummy
database of your choice and look into the commands package defined in your game directory
(<code class="docutils literal notranslate"><span class="pre">mygame/commands</span></code> in this example) to find tests. The test modules name should begin with test
and contain one or more <code class="docutils literal notranslate"><span class="pre">TestCase</span></code>. A full example can be found below.</p>
</section>
<section id="a-simple-example">
<h3>A simple example<a class="headerlink" href="#a-simple-example" title="Permalink to this headline"></a></h3>
<p>In your game directory, go to <code class="docutils literal notranslate"><span class="pre">commands</span></code> and create a new file <code class="docutils literal notranslate"><span class="pre">tests.py</span></code> inside (it could be named
anything starting with <code class="docutils literal notranslate"><span class="pre">test</span></code>). We will start by making a test that has nothing to do with Commands,
just to show how unit testing works:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="c1"># mygame/commands/tests.py</span>
<span class="kn">import</span> <span class="nn">unittest</span>
<span class="k">class</span> <span class="nc">TestString</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Unittest for strings (just a basic example).&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">test_upper</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Test the upper() str method.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="o">.</span><span class="n">upper</span><span class="p">(),</span> <span class="s1">&#39;FOO&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>This example, inspired from the Python documentation, is used to test the upper() method of the
str class. Not very useful, but it should give you a basic idea of how tests are used.</p>
<p>Lets execute that test to see if it works.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; evennia --settings settings.py test commands
TESTING: Using specified settings file &#39;server.conf.settings&#39;.
(Obs: Evennia&#39;s full test suite may not pass if the settings are very
different from the default. Use &#39;test .&#39; as arguments to run only tests
on the game dir.)
Creating test database for alias &#39;default&#39;...
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
Destroying test database for alias &#39;default&#39;...
</pre></div>
</div>
<p>We specified the <code class="docutils literal notranslate"><span class="pre">commands</span></code> package to the evennia test command since thats where we put our test
file. In this case we could just as well just said <code class="docutils literal notranslate"><span class="pre">.</span></code> to search all of <code class="docutils literal notranslate"><span class="pre">mygame</span></code> for testing files.
If we have a lot of tests it may be useful to test only a single set at a time though. We get an
information text telling us we are using our custom settings file (instead of Evennias default
file) and then the test runs. The test passes! Change the “FOO” string to something else in the test
to see how it looks when it fails.</p>
</section>
<section id="testing-commands">
<h3>Testing commands<a class="headerlink" href="#testing-commands" title="Permalink to this headline"></a></h3>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This is not correct anymore.</p>
</div>
<p>This section will test the proper execution of the abilities command, as described in the DELETED
tutorial to create the abilities command, we will need it to test it.</p>
<p>Testing commands in Evennia is a bit more complex than the simple testing example we have seen.
Luckily, Evennia supplies a special test class to do just that … we just need to inherit from it
and use it properly. This class is called CommandTest and is defined in the
evennia.commands.default.tests package. To create a test for our abilities command, we just
need to create a class that inherits from CommandTest and add methods.</p>
<p>We could create a new test file for this but for now we just append to the <code class="docutils literal notranslate"><span class="pre">tests.py</span></code> file we
already have in <code class="docutils literal notranslate"><span class="pre">commands</span></code> from before.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span> <span class="c1"># bottom of mygame/commands/tests.py</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">CommandTest</span>
<span class="kn">from</span> <span class="nn">commands.command</span> <span class="kn">import</span> <span class="n">CmdAbilities</span>
<span class="kn">from</span> <span class="nn">typeclasses.characters</span> <span class="kn">import</span> <span class="n">Character</span>
<span class="k">class</span> <span class="nc">TestAbilities</span><span class="p">(</span><span class="n">CommandTest</span><span class="p">):</span>
<span class="n">character_typeclass</span> <span class="o">=</span> <span class="n">Character</span>
<span class="k">def</span> <span class="nf">test_simple</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">CmdAbilities</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;STR: 5, AGI: 4, MAG: 2&quot;</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li><p>Line 1-4: we do some importing. CommandTest is going to be our base class for our test, so we
need it. We also import our command (CmdAbilities in this case). Finally we import the
Character typeclass. We need it, since CommandTest doesnt use Character, but
DefaultCharacter, which means the character calling the command wont have the abilities we have
written in the Character typeclass.</p></li>
<li><p>Line 6-8: thats the body of our test. Here, a single command is tested in an entire class.
Default commands are usually grouped by category in a single class. There is no rule, as long as
you know where you put your tests. Note that we set the character_typeclass class attribute to
Character. As explained above, if you didnt do that, the system would create a DefaultCharacter
object, not a Character. You can try to remove line 4 and 8 to see what happens when running the
test.</p></li>
<li><p>Line 10-11: our unique testing method. Note its name: it should begin by test_. Apart from
that, the method is quite simple: its an instance method (so it takes the self argument) but no
other arguments are needed. Line 11 uses the call method, which is defined in CommandTest.
Its a useful method that compares a command against an expected result. It would be like comparing
two strings with assertEqual, but the call method does more things, including testing the
command in a realistic way (calling its hooks in the right order, so you dont have to worry about
that).</p></li>
</ul>
<p>Line 11 can be understood as: test the abilities command (first parameter), with no argument
(second parameter), and check that the character using it receives his/her abilities (third
parameter).</p>
<p>Lets run our new test:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt; evennia --settings settings.py test commands
[...]
Creating test database for alias &#39;default&#39;...
..
----------------------------------------------------------------------
Ran 2 tests in 0.156s
OK
Destroying test database for alias &#39;default&#39;...
</pre></div>
</div>
<p>Two tests were executed, since we have kept TestString from last time. In case of failure, you
will get much more information to help you fix the bug.</p>
</section>
</section>
</section>
@ -442,23 +366,17 @@ will get much more information to help you fix the bug.</p>
<ul>
<li><a class="reference internal" href="#">Unit Testing</a><ul>
<li><a class="reference internal" href="#running-the-evennia-test-suite">Running the Evennia test suite</a></li>
<li><a class="reference internal" href="#running-tests-with-custom-settings-file">Running tests with custom settings file</a></li>
<li><a class="reference internal" href="#writing-new-tests">Writing new tests</a><ul>
<li><a class="reference internal" href="#using-the-evenniatest-class">Using the EvenniaTest class</a></li>
<li><a class="reference internal" href="#testing-in-game-commands">Testing in-game Commands</a></li>
<li><a class="reference internal" href="#running-tests-for-your-game-dir">Running tests for your game dir</a></li>
<li><a class="reference internal" href="#writing-new-tests">Writing new tests</a></li>
<li><a class="reference internal" href="#using-the-evennia-testing-classes">Using the Evennia testing classes</a><ul>
<li><a class="reference internal" href="#classes-for-testing-your-game-dir">Classes for testing your game dir</a></li>
<li><a class="reference internal" href="#classes-for-testing-evennia-core">Classes for testing Evennia core</a></li>
</ul>
</li>
<li><a class="reference internal" href="#unit-testing-contribs-with-custom-models">Unit testing contribs with custom models</a></li>
<li><a class="reference internal" href="#a-note-on-adding-new-tests">A note on adding new tests</a></li>
<li><a class="reference internal" href="#a-note-on-making-the-test-runner-faster">A note on making the test runner faster</a></li>
</ul>
</li>
<li><a class="reference internal" href="#testing-for-game-development-mini-tutorial">Testing for Game development (mini-tutorial)</a><ul>
<li><a class="reference internal" href="#basic-testing-using-evennia">Basic testing using Evennia</a></li>
<li><a class="reference internal" href="#a-simple-example">A simple example</a></li>
<li><a class="reference internal" href="#testing-commands">Testing commands</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div role="note" aria-label="source link">

View file

@ -55,8 +55,6 @@
<span class="sd"> &gt; python game/manage.py test.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">types</span>
<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">from</span> <span class="nn">anything</span> <span class="kn">import</span> <span class="n">Anything</span>
@ -67,7 +65,7 @@
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultRoom</span><span class="p">,</span> <span class="n">DefaultExit</span><span class="p">,</span> <span class="n">ObjectDB</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.cmdset_character</span> <span class="kn">import</span> <span class="n">CharacterCmdSet</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">EvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">BaseEvenniaCommandTest</span><span class="p">,</span> <span class="n">EvenniaCommandTest</span> <span class="c1"># noqa</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default</span> <span class="kn">import</span> <span class="p">(</span>
<span class="n">help</span> <span class="k">as</span> <span class="n">help_module</span><span class="p">,</span>
<span class="n">general</span><span class="p">,</span>
@ -84,305 +82,18 @@
<span class="kn">from</span> <span class="nn">evennia.commands.command</span> <span class="kn">import</span> <span class="n">Command</span><span class="p">,</span> <span class="n">InterruptCommand</span>
<span class="kn">from</span> <span class="nn">evennia.commands</span> <span class="kn">import</span> <span class="n">cmdparser</span>
<span class="kn">from</span> <span class="nn">evennia.commands.cmdset</span> <span class="kn">import</span> <span class="n">CmdSet</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">ansi</span><span class="p">,</span> <span class="n">utils</span><span class="p">,</span> <span class="n">gametime</span><span class="p">,</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">utils</span><span class="p">,</span> <span class="n">gametime</span><span class="p">,</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.server.sessionhandler</span> <span class="kn">import</span> <span class="n">SESSIONS</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">search_object</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">DefaultObject</span><span class="p">,</span> <span class="n">DefaultCharacter</span>
<span class="kn">from</span> <span class="nn">evennia.prototypes</span> <span class="kn">import</span> <span class="n">prototypes</span> <span class="k">as</span> <span class="n">protlib</span>
<span class="c1"># set up signal here since we are not starting the server</span>
<span class="n">_RE_STRIP_EVMENU</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^\+|-+\+|\+-+|--+|\|(?:\s|$)&quot;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">MULTILINE</span><span class="p">)</span>
<span class="c1"># ------------------------------------------------------------</span>
<span class="c1"># Command testing</span>
<span class="c1"># ------------------------------------------------------------</span>
<div class="viewcode-block" id="CommandTestMixin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.server.portal.portal.LoopingCall&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">MagicMock</span><span class="p">())</span>
<span class="k">class</span> <span class="nc">CommandTestMixin</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Mixin to add to a test in order to provide the `.call` helper for</span>
<span class="sd"> testing the execution and returns of a command.</span>
<span class="sd"> Tests a Command by running it and comparing what messages it sends with</span>
<span class="sd"> expected values. This tests without actually spinning up the cmdhandler</span>
<span class="sd"> for every test, which is more controlled.</span>
<span class="sd"> Example:</span>
<span class="sd"> ::</span>
<span class="sd"> from commands.echo import CmdEcho</span>
<span class="sd"> class MyCommandTest(EvenniaTest, CommandTestMixin):</span>
<span class="sd"> def test_echo(self):</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> self.call(MyCommand(), &quot;hello world!&quot;,</span>
<span class="sd"> &quot;You hear your echo: &#39;Hello world!&#39;&quot;)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># formatting for .call&#39;s error message</span>
<span class="n">_ERROR_FORMAT</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="s2">=========================== Wanted message ===================================</span>
<span class="si">{expected_msg}</span><span class="s2"></span>
<span class="s2">=========================== Returned message =================================</span>
<span class="si">{returned_msg}</span><span class="s2"></span>
<span class="s2">==============================================================================</span>
<span class="s2">&quot;&quot;&quot;</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
<div class="viewcode-block" id="CommandTestMixin.call"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin.call">[docs]</a> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">cmdobj</span><span class="p">,</span>
<span class="n">input_args</span><span class="p">,</span>
<span class="n">msg</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdset</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">noansi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">caller</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">receiver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdstring</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">obj</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">inputs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">raw_string</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test a command by assigning all the needed properties to a cmdobj and</span>
<span class="sd"> running the sequence. The resulting `.msg` calls will be mocked and</span>
<span class="sd"> the text= calls to them compared to a expected output.</span>
<span class="sd"> Args:</span>
<span class="sd"> cmdobj (Command): The command object to use.</span>
<span class="sd"> input_args (str): This should be the full input the Command should</span>
<span class="sd"> see, such as &#39;look here&#39;. This will become `.args` for the Command</span>
<span class="sd"> instance to parse.</span>
<span class="sd"> msg (str or dict, optional): This is the expected return value(s)</span>
<span class="sd"> returned through `caller.msg(text=...)` calls in the command. If a string, the</span>
<span class="sd"> receiver is controlled with the `receiver` kwarg (defaults to `caller`).</span>
<span class="sd"> If this is a `dict`, it is a mapping</span>
<span class="sd"> `{receiver1: &quot;expected1&quot;, receiver2: &quot;expected2&quot;,...}` and `receiver` is</span>
<span class="sd"> ignored. The message(s) are compared with the actual messages returned</span>
<span class="sd"> to the receiver(s) as the Command runs. Each check uses `.startswith`,</span>
<span class="sd"> so you can choose to only include the first part of the</span>
<span class="sd"> returned message if that&#39;s enough to verify a correct result. EvMenu</span>
<span class="sd"> decorations (like borders) are stripped and should not be included. This</span>
<span class="sd"> should also not include color tags unless `noansi=False`.</span>
<span class="sd"> If the command returns texts in multiple separate `.msg`-</span>
<span class="sd"> calls to a receiver, separate these with `|` if `noansi=True`</span>
<span class="sd"> (default) and `||` if `noansi=False`. If no `msg` is given (`None`),</span>
<span class="sd"> then no automatic comparison will be done.</span>
<span class="sd"> cmdset (str, optional): If given, make `.cmdset` available on the Command</span>
<span class="sd"> instance as it runs. While `.cmdset` is normally available on the</span>
<span class="sd"> Command instance by default, this is usually only used by</span>
<span class="sd"> commands that explicitly operates/displays cmdsets, like</span>
<span class="sd"> `examine`.</span>
<span class="sd"> noansi (str, optional): By default the color tags of the `msg` is</span>
<span class="sd"> ignored, this makes them significant. If unset, `msg` must contain</span>
<span class="sd"> the same color tags as the actual return message.</span>
<span class="sd"> caller (Object or Account, optional): By default `self.char1` is used as the</span>
<span class="sd"> command-caller (the `.caller` property on the Command). This allows to</span>
<span class="sd"> execute with another caller, most commonly an Account.</span>
<span class="sd"> receiver (Object or Account, optional): This is the object to receive the</span>
<span class="sd"> return messages we want to test. By default this is the same as `caller`</span>
<span class="sd"> (which in turn defaults to is `self.char1`). Note that if `msg` is</span>
<span class="sd"> a `dict`, this is ignored since the receiver is already specified there.</span>
<span class="sd"> cmdstring (str, optional): Normally this is the Command&#39;s `key`.</span>
<span class="sd"> This allows for tweaking the `.cmdname` property of the</span>
<span class="sd"> Command`. This isb used for commands with multiple aliases,</span>
<span class="sd"> where the command explicitly checs which alias was used to</span>
<span class="sd"> determine its functionality.</span>
<span class="sd"> obj (str, optional): This sets the `.obj` property of the Command - the</span>
<span class="sd"> object on which the Command &#39;sits&#39;. By default this is the same as `caller`.</span>
<span class="sd"> This can be used for testing on-object Command interactions.</span>
<span class="sd"> inputs (list, optional): A list of strings to pass to functions that pause to</span>
<span class="sd"> take input from the user (normally using `@interactive` and</span>
<span class="sd"> `ret = yield(question)` or `evmenu.get_input`). Each element of the</span>
<span class="sd"> list will be passed into the command as if the user wrote that at the prompt.</span>
<span class="sd"> raw_string (str, optional): Normally the `.raw_string` property is set as</span>
<span class="sd"> a combination of your `key/cmdname` and `input_args`. This allows</span>
<span class="sd"> direct control of what this is, for example for testing edge cases</span>
<span class="sd"> or malformed inputs.</span>
<span class="sd"> Returns:</span>
<span class="sd"> str or dict: The message sent to `receiver`, or a dict of</span>
<span class="sd"> `{receiver: &quot;msg&quot;, ...}` if multiple are given. This is usually</span>
<span class="sd"> only used with `msg=None` to do the validation externally.</span>
<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If the returns of `.msg` calls (tested with `.startswith`) does not</span>
<span class="sd"> match `expected_input`.</span>
<span class="sd"> Notes:</span>
<span class="sd"> As part of the tests, all methods of the Command will be called in</span>
<span class="sd"> the proper order:</span>
<span class="sd"> - cmdobj.at_pre_cmd()</span>
<span class="sd"> - cmdobj.parse()</span>
<span class="sd"> - cmdobj.func()</span>
<span class="sd"> - cmdobj.at_post_cmd()</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># The `self.char1` is created in the `EvenniaTest` base along with</span>
<span class="c1"># other helper objects like self.room and self.obj</span>
<span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="o">=</span> <span class="n">cmdstring</span> <span class="k">if</span> <span class="n">cmdstring</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_cmdname</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdstring</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="c1"># deprecated</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdset</span> <span class="o">=</span> <span class="n">cmdset</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">SESSIONS</span><span class="o">.</span><span class="n">session_from_sessid</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">account</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">account</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_string</span> <span class="o">=</span> <span class="n">raw_string</span> <span class="k">if</span> <span class="n">raw_string</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> <span class="ow">or</span> <span class="p">(</span><span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">)</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="n">inputs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="c1"># set up receivers</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="c1"># a mapping {receiver: msg, ...}</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">recv</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">recv</span><span class="p">,</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">msg</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># a single expected string and thus a single receiver (defaults to caller)</span>
<span class="n">receiver</span> <span class="o">=</span> <span class="n">receiver</span> <span class="k">if</span> <span class="n">receiver</span> <span class="k">else</span> <span class="n">caller</span>
<span class="n">receiver_mapping</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">unmocked_msg_methods</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="p">:</span>
<span class="c1"># save the old .msg method so we can get it back</span>
<span class="c1"># cleanly after the test</span>
<span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span>
<span class="c1"># replace normal `.msg` with a mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="c1"># Run the methods of the Command. This mimics what happens in the</span>
<span class="c1"># cmdhandler. This will have the mocked .msg be called as part of the</span>
<span class="c1"># execution. Mocks remembers what was sent to them so we will be able</span>
<span class="c1"># to retrieve what was sent later.</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">at_pre_cmd</span><span class="p">():</span>
<span class="k">return</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">parse</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
<span class="c1"># handle func&#39;s with yield in them (making them generators)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">GeneratorType</span><span class="p">):</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">inp</span> <span class="o">=</span> <span class="n">inputs</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="k">if</span> <span class="n">inputs</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">if</span> <span class="n">inp</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># this mimics a user&#39;s reply to a prompt</span>
<span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># non-input yield, like yield(10). We don&#39;t pause</span>
<span class="c1"># but fire it immediately.</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">at_post_cmd</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">except</span> <span class="n">InterruptCommand</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">for</span> <span class="n">inp</span> <span class="ow">in</span> <span class="n">inputs</span><span class="p">:</span>
<span class="c1"># if there are any inputs left, we may have a non-generator</span>
<span class="c1"># input to handle (get_input/ask_yes_no that uses a separate</span>
<span class="c1"># cmdset rather than a yield</span>
<span class="n">caller</span><span class="o">.</span><span class="n">execute_cmd</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="c1"># At this point the mocked .msg methods on each receiver will have</span>
<span class="c1"># stored all calls made to them (that&#39;s a basic function of the Mock</span>
<span class="c1"># class). We will not extract them and compare to what we expected to</span>
<span class="c1"># go to each receiver.</span>
<span class="n">returned_msgs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span><span class="p">,</span> <span class="n">expected_msg</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="c1"># get the stored messages from the Mock with Mock.mock_calls.</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">else</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">,</span> <span class="n">utils</span><span class="o">.</span><span class="n">to_str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">))</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span> <span class="ow">in</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span><span class="o">.</span><span class="n">mock_calls</span>
<span class="p">]</span>
<span class="c1"># we can return this now, we are done using the mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span>
<span class="c1"># Get the first element of a tuple if msg received a tuple instead of a string</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">smsg</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)</span> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">)</span> <span class="k">for</span> <span class="n">smsg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">]</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># no expected_msg; just build the returned_msgs dict</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">returned_msg</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># compare messages to expected</span>
<span class="c1"># set our separator for returned messages based on parsing ansi or not</span>
<span class="n">msg_sep</span> <span class="o">=</span> <span class="s2">&quot;|&quot;</span> <span class="k">if</span> <span class="n">noansi</span> <span class="k">else</span> <span class="s2">&quot;||&quot;</span>
<span class="c1"># We remove Evmenu decorations since that just makes it harder</span>
<span class="c1"># to write the comparison string. We also strip ansi before this</span>
<span class="c1"># comparison since otherwise it would mess with the regex.</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="n">msg_sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
<span class="n">_RE_STRIP_EVMENU</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span>
<span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">mess</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">))</span>
<span class="k">for</span> <span class="n">mess</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="c1"># this is the actual test</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="ow">and</span> <span class="n">returned_msg</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">returned_msg</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">expected_msg</span><span class="p">):</span>
<span class="c1"># failed the test</span>
<span class="k">raise</span> <span class="ne">AssertionError</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ERROR_FORMAT</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">expected_msg</span><span class="o">=</span><span class="n">expected_msg</span><span class="p">,</span> <span class="n">returned_msg</span><span class="o">=</span><span class="n">returned_msg</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># passed!</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">returned_msg</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">returned_msgs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">returned_msgs</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">return</span> <span class="n">returned_msgs</span></div></div>
<div class="viewcode-block" id="EvenniaCommandTest"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.account.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.admin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.batchprocess.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.building.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.comms.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.general.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.help.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.syscommands.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.system.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.unloggedin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">EvenniaCommandTest</span><span class="p">(</span><span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Commands only using the default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="CommandTest"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTest">[docs]</a><span class="k">class</span> <span class="nc">CommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parent class to inherit from - makes tests use your own</span>
<span class="sd"> classes and settings in mygame.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<span class="c1"># ------------------------------------------------------------</span>
<span class="c1"># Individual module Tests</span>
<span class="c1"># ------------------------------------------------------------</span>
<div class="viewcode-block" id="TestGeneral"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral">[docs]</a><span class="k">class</span> <span class="nc">TestGeneral</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGeneral"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral">[docs]</a><span class="k">class</span> <span class="nc">TestGeneral</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGeneral.test_look"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestGeneral.test_look">[docs]</a> <span class="k">def</span> <span class="nf">test_look</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">rid</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="o">.</span><span class="n">id</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdLook</span><span class="p">(),</span> <span class="s2">&quot;here&quot;</span><span class="p">,</span> <span class="s2">&quot;Room(#</span><span class="si">{}</span><span class="s2">)</span><span class="se">\n</span><span class="s2">room_desc&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">rid</span><span class="p">))</span></div>
@ -478,7 +189,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">general</span><span class="o">.</span><span class="n">CmdAccess</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Permission Hierarchy (climbing):&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestHelp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestHelp">[docs]</a><span class="k">class</span> <span class="nc">TestHelp</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestHelp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestHelp">[docs]</a><span class="k">class</span> <span class="nc">TestHelp</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="n">maxDiff</span> <span class="o">=</span> <span class="kc">None</span>
@ -628,7 +339,7 @@
<span class="n">cmdset</span><span class="o">=</span><span class="n">TestCmdSet</span><span class="p">())</span></div>
<div class="viewcode-block" id="TestSystem"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem">[docs]</a><span class="k">class</span> <span class="nc">TestSystem</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystem"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem">[docs]</a><span class="k">class</span> <span class="nc">TestSystem</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystem.test_py"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystem.test_py">[docs]</a> <span class="k">def</span> <span class="nf">test_py</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># we are not testing CmdReload, CmdReset and CmdShutdown, CmdService or CmdTime</span>
<span class="c1"># since the server is not running during these tests.</span>
@ -652,7 +363,7 @@
<div class="viewcode-block" id="func_test_cmd_tasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.func_test_cmd_tasks">[docs]</a><span class="k">def</span> <span class="nf">func_test_cmd_tasks</span><span class="p">():</span>
<span class="k">return</span> <span class="s1">&#39;success&#39;</span></div>
<div class="viewcode-block" id="TestCmdTasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks">[docs]</a><span class="k">class</span> <span class="nc">TestCmdTasks</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestCmdTasks"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks">[docs]</a><span class="k">class</span> <span class="nc">TestCmdTasks</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestCmdTasks.setUp"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCmdTasks.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
@ -812,7 +523,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">CmdTasks</span><span class="p">(),</span> <span class="sa">f</span><span class="s1">&#39;/cancel&#39;</span><span class="p">,</span> <span class="n">wanted_msg</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestAdmin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin">[docs]</a><span class="k">class</span> <span class="nc">TestAdmin</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAdmin"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin">[docs]</a><span class="k">class</span> <span class="nc">TestAdmin</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAdmin.test_emit"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAdmin.test_emit">[docs]</a> <span class="k">def</span> <span class="nf">test_emit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">admin</span><span class="o">.</span><span class="n">CmdEmit</span><span class="p">(),</span> <span class="s2">&quot;Char2 = Test&quot;</span><span class="p">,</span> <span class="s2">&quot;Emitted to Char2:</span><span class="se">\n</span><span class="s2">Test&quot;</span><span class="p">)</span></div>
@ -843,7 +554,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestAccount"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount">[docs]</a><span class="k">class</span> <span class="nc">TestAccount</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAccount"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount">[docs]</a><span class="k">class</span> <span class="nc">TestAccount</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestAccount.test_ooc_look"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestAccount.test_ooc_look">[docs]</a> <span class="k">def</span> <span class="nf">test_ooc_look</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">MULTISESSION_MODE</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -967,7 +678,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestBuilding"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding">[docs]</a><span class="k">class</span> <span class="nc">TestBuilding</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuilding"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding">[docs]</a><span class="k">class</span> <span class="nc">TestBuilding</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuilding.test_create"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBuilding.test_create">[docs]</a> <span class="k">def</span> <span class="nf">test_create</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">name</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_OBJECT_TYPECLASS</span><span class="o">.</span><span class="n">rsplit</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -2035,7 +1746,7 @@
<div class="viewcode-block" id="TestCommsChannel"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestCommsChannel">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.default.comms.CHANNEL_DEFAULT_TYPECLASS&quot;</span><span class="p">,</span> <span class="n">DefaultChannel</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">TestCommsChannel</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TestCommsChannel</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test the central `channel` command.</span>
@ -2258,7 +1969,7 @@
<span class="kn">from</span> <span class="nn">evennia.commands.default</span> <span class="kn">import</span> <span class="n">comms</span> <span class="c1"># noqa</span>
<div class="viewcode-block" id="TestComms"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms">[docs]</a><span class="k">class</span> <span class="nc">TestComms</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestComms"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms">[docs]</a><span class="k">class</span> <span class="nc">TestComms</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestComms.test_page"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestComms.test_page">[docs]</a> <span class="k">def</span> <span class="nf">test_page</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
@ -2270,7 +1981,7 @@
<span class="p">)</span></div></div>
<div class="viewcode-block" id="TestBatchProcess"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBatchProcess">[docs]</a><span class="k">class</span> <span class="nc">TestBatchProcess</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBatchProcess"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestBatchProcess">[docs]</a><span class="k">class</span> <span class="nc">TestBatchProcess</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test the batch processor.</span>
@ -2306,13 +2017,13 @@
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">&quot;in func&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestInterruptCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand">[docs]</a><span class="k">class</span> <span class="nc">TestInterruptCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestInterruptCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand">[docs]</a><span class="k">class</span> <span class="nc">TestInterruptCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestInterruptCommand.test_interrupt_command"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command">[docs]</a> <span class="k">def</span> <span class="nf">test_interrupt_command</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">ret</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">CmdInterrupt</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestUnconnectedCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnconnectedCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnconnectedCommand"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnconnectedCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnconnectedCommand.test_info_command"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestUnconnectedCommand.test_info_command">[docs]</a> <span class="k">def</span> <span class="nf">test_info_command</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># instead of using SERVER_START_TIME (0), we use 86400 because Windows won&#39;t let us use anything lower</span>
<span class="n">gametime</span><span class="o">.</span><span class="n">SERVER_START_TIME</span> <span class="o">=</span> <span class="mi">86400</span>
@ -2332,7 +2043,7 @@
<span class="c1"># Test syscommands</span>
<div class="viewcode-block" id="TestSystemCommands"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestSystemCommands</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystemCommands"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestSystemCommands</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSystemCommands.test_simple_defaults"><a class="viewcode-back" href="../../../../api/evennia.commands.default.tests.html#evennia.commands.default.tests.TestSystemCommands.test_simple_defaults">[docs]</a> <span class="k">def</span> <span class="nf">test_simple_defaults</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">syscommands</span><span class="o">.</span><span class="n">SystemNoInput</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">syscommands</span><span class="o">.</span><span class="n">SystemNoMatch</span><span class="p">(),</span> <span class="s2">&quot;Huh?&quot;</span><span class="p">)</span></div>

View file

@ -47,7 +47,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="n">building_menu</span> <span class="kn">import</span> <span class="nn">BuildingMenu</span><span class="o">,</span> <span class="nn">CmdNoMatch</span>
@ -56,7 +56,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">add_choice</span><span class="p">(</span><span class="s2">&quot;title&quot;</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;t&quot;</span><span class="p">,</span> <span class="n">attr</span><span class="o">=</span><span class="s2">&quot;key&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestBuildingMenu"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.building_menu.tests.html#evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu">[docs]</a><span class="k">class</span> <span class="nc">TestBuildingMenu</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuildingMenu"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.building_menu.tests.html#evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu">[docs]</a><span class="k">class</span> <span class="nc">TestBuildingMenu</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBuildingMenu.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.building_menu.tests.html#evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">TestBuildingMenu</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">menu</span> <span class="o">=</span> <span class="n">BuildingMenu</span><span class="p">(</span><span class="n">caller</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">,</span> <span class="n">obj</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="p">,</span> <span class="n">title</span><span class="o">=</span><span class="s2">&quot;test&quot;</span><span class="p">)</span>

View file

@ -47,11 +47,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">email_login</span>
<div class="viewcode-block" id="TestEmailLogin"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.email_login.tests.html#evennia.contrib.base_systems.email_login.tests.TestEmailLogin">[docs]</a><span class="k">class</span> <span class="nc">TestEmailLogin</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestEmailLogin"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.email_login.tests.html#evennia.contrib.base_systems.email_login.tests.TestEmailLogin">[docs]</a><span class="k">class</span> <span class="nc">TestEmailLogin</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestEmailLogin.test_connect"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.email_login.tests.html#evennia.contrib.base_systems.email_login.tests.TestEmailLogin.test_connect">[docs]</a> <span class="k">def</span> <span class="nf">test_connect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
<span class="n">email_login</span><span class="o">.</span><span class="n">CmdUnconnectedConnect</span><span class="p">(),</span>

View file

@ -51,7 +51,7 @@
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">ScriptDB</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">ExitCommand</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">ansi</span><span class="p">,</span> <span class="n">utils</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span><span class="p">,</span> <span class="n">create_script</span>
@ -290,7 +290,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="o">.</span><span class="n">callbacks</span><span class="o">.</span><span class="n">all</span><span class="p">(),</span> <span class="p">{})</span></div></div>
<div class="viewcode-block" id="TestCmdCallback"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.ingame_python.tests.html#evennia.contrib.base_systems.ingame_python.tests.TestCmdCallback">[docs]</a><span class="k">class</span> <span class="nc">TestCmdCallback</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestCmdCallback"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.ingame_python.tests.html#evennia.contrib.base_systems.ingame_python.tests.TestCmdCallback">[docs]</a><span class="k">class</span> <span class="nc">TestCmdCallback</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Test the @callback command.&quot;&quot;&quot;</span>
@ -469,7 +469,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">callback</span><span class="o">.</span><span class="n">valid</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestDefaultCallbacks"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.ingame_python.tests.html#evennia.contrib.base_systems.ingame_python.tests.TestDefaultCallbacks">[docs]</a><span class="k">class</span> <span class="nc">TestDefaultCallbacks</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestDefaultCallbacks"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.ingame_python.tests.html#evennia.contrib.base_systems.ingame_python.tests.TestDefaultCallbacks">[docs]</a><span class="k">class</span> <span class="nc">TestDefaultCallbacks</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Test the default callbacks.&quot;&quot;&quot;</span>

View file

@ -47,11 +47,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">mux_comms_cmds</span> <span class="k">as</span> <span class="n">comms</span>
<div class="viewcode-block" id="TestLegacyMuxComms"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.mux_comms_cmds.tests.html#evennia.contrib.base_systems.mux_comms_cmds.tests.TestLegacyMuxComms">[docs]</a><span class="k">class</span> <span class="nc">TestLegacyMuxComms</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestLegacyMuxComms"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.mux_comms_cmds.tests.html#evennia.contrib.base_systems.mux_comms_cmds.tests.TestLegacyMuxComms">[docs]</a><span class="k">class</span> <span class="nc">TestLegacyMuxComms</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test the legacy comms contrib.</span>
<span class="sd"> &quot;&quot;&quot;</span>

View file

@ -47,7 +47,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.unixcommand</span> <span class="kn">import</span> <span class="n">UnixCommand</span>
@ -74,7 +74,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">msg</span><span class="p">(</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> * </span><span class="si">{}</span><span class="s2"> = </span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">nb1</span><span class="p">,</span> <span class="n">nb2</span><span class="p">,</span> <span class="n">result</span><span class="p">))</span></div></div>
<div class="viewcode-block" id="TestUnixCommand"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.unixcommand.tests.html#evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnixCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnixCommand"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.unixcommand.tests.html#evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand">[docs]</a><span class="k">class</span> <span class="nc">TestUnixCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestUnixCommand.test_success"><a class="viewcode-back" href="../../../../../api/evennia.contrib.base_systems.unixcommand.tests.html#evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand.test_success">[docs]</a> <span class="k">def</span> <span class="nf">test_success</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;See the command parsing succeed.&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">CmdDummy</span><span class="p">(),</span> <span class="s2">&quot;5 10&quot;</span><span class="p">,</span> <span class="s2">&quot;5 * 10 = 50&quot;</span><span class="p">)</span>

View file

@ -49,7 +49,7 @@
<span class="kn">import</span> <span class="nn">inspect</span>
<span class="kn">import</span> <span class="nn">pkgutil</span>
<span class="kn">from</span> <span class="nn">os</span> <span class="kn">import</span> <span class="n">path</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">InterruptCommand</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">mod_import</span>
@ -59,7 +59,7 @@
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">utils</span>
<div class="viewcode-block" id="TestEvscaperoomCommands"><a class="viewcode-back" href="../../../../../api/evennia.contrib.full_systems.evscaperoom.tests.html#evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands">[docs]</a><span class="k">class</span> <span class="nc">TestEvscaperoomCommands</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestEvscaperoomCommands"><a class="viewcode-back" href="../../../../../api/evennia.contrib.full_systems.evscaperoom.tests.html#evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands">[docs]</a><span class="k">class</span> <span class="nc">TestEvscaperoomCommands</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestEvscaperoomCommands.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.full_systems.evscaperoom.tests.html#evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">room1</span> <span class="o">=</span> <span class="n">utils</span><span class="o">.</span><span class="n">create_evscaperoom_object</span><span class="p">(</span><span class="s2">&quot;evscaperoom.room.EvscapeRoom&quot;</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;Testroom&quot;</span><span class="p">)</span>

View file

@ -47,12 +47,12 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">barter</span>
<div class="viewcode-block" id="TestBarter"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.barter.tests.html#evennia.contrib.game_systems.barter.tests.TestBarter">[docs]</a><span class="k">class</span> <span class="nc">TestBarter</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBarter"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.barter.tests.html#evennia.contrib.game_systems.barter.tests.TestBarter">[docs]</a><span class="k">class</span> <span class="nc">TestBarter</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestBarter.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.barter.tests.html#evennia.contrib.game_systems.barter.tests.TestBarter.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">tradeitem1</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">&quot;TradeItem1&quot;</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">)</span>

View file

@ -47,14 +47,14 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">DefaultRoom</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">clothing</span>
<div class="viewcode-block" id="TestClothingCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.clothing.tests.html#evennia.contrib.game_systems.clothing.tests.TestClothingCmd">[docs]</a><span class="k">class</span> <span class="nc">TestClothingCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestClothingCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.clothing.tests.html#evennia.contrib.game_systems.clothing.tests.TestClothingCmd">[docs]</a><span class="k">class</span> <span class="nc">TestClothingCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestClothingCmd.test_clothingcommands"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.clothing.tests.html#evennia.contrib.game_systems.clothing.tests.TestClothingCmd.test_clothingcommands">[docs]</a> <span class="k">def</span> <span class="nf">test_clothingcommands</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">wearer</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">clothing</span><span class="o">.</span><span class="n">ClothedCharacter</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;Wearer&quot;</span><span class="p">)</span>
<span class="n">friend</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">clothing</span><span class="o">.</span><span class="n">ClothedCharacter</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;Friend&quot;</span><span class="p">)</span>

View file

@ -50,7 +50,7 @@
<span class="kn">from</span> <span class="nn">unittest</span> <span class="kn">import</span> <span class="n">mock</span>
<span class="kn">from</span> <span class="nn">django.test</span> <span class="kn">import</span> <span class="n">override_settings</span>
<span class="kn">from</span> <span class="nn">django.core.exceptions</span> <span class="kn">import</span> <span class="n">ObjectDoesNotExist</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTestCase</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">crafting</span><span class="p">,</span> <span class="n">example_recipes</span>
@ -699,7 +699,7 @@
<div class="viewcode-block" id="TestCraftCommand"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.crafting.tests.html#evennia.contrib.game_systems.crafting.tests.TestCraftCommand">[docs]</a><span class="nd">@mock</span><span class="o">.</span><span class="n">patch</span><span class="p">(</span><span class="s2">&quot;evennia.contrib.game_systems.crafting.crafting._load_recipes&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">mock</span><span class="o">.</span><span class="n">MagicMock</span><span class="p">())</span>
<span class="nd">@mock</span><span class="o">.</span><span class="n">patch</span><span class="p">(</span><span class="s2">&quot;evennia.contrib.game_systems.crafting.crafting._RECIPE_CLASSES&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;testrecipe&quot;</span><span class="p">:</span> <span class="n">_MockRecipe</span><span class="p">})</span>
<span class="nd">@override_settings</span><span class="p">(</span><span class="n">CRAFT_RECIPE_MODULES</span><span class="o">=</span><span class="p">[])</span>
<span class="k">class</span> <span class="nc">TestCraftCommand</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TestCraftCommand</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Test the crafting command&quot;&quot;&quot;</span>
<div class="viewcode-block" id="TestCraftCommand.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.crafting.tests.html#evennia.contrib.game_systems.crafting.tests.TestCraftCommand.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

View file

@ -48,13 +48,13 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">gendersub</span>
<div class="viewcode-block" id="TestGenderSub"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.gendersub.tests.html#evennia.contrib.game_systems.gendersub.tests.TestGenderSub">[docs]</a><span class="k">class</span> <span class="nc">TestGenderSub</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGenderSub"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.gendersub.tests.html#evennia.contrib.game_systems.gendersub.tests.TestGenderSub">[docs]</a><span class="k">class</span> <span class="nc">TestGenderSub</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestGenderSub.test_setgender"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.gendersub.tests.html#evennia.contrib.game_systems.gendersub.tests.TestGenderSub.test_setgender">[docs]</a> <span class="k">def</span> <span class="nf">test_setgender</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">gendersub</span><span class="o">.</span><span class="n">SetGender</span><span class="p">(),</span> <span class="s2">&quot;male&quot;</span><span class="p">,</span> <span class="s2">&quot;Your gender was set to male.&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">gendersub</span><span class="o">.</span><span class="n">SetGender</span><span class="p">(),</span> <span class="s2">&quot;ambiguous&quot;</span><span class="p">,</span> <span class="s2">&quot;Your gender was set to ambiguous.&quot;</span><span class="p">)</span>

View file

@ -47,11 +47,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">mail</span>
<div class="viewcode-block" id="TestMail"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.mail.tests.html#evennia.contrib.game_systems.mail.tests.TestMail">[docs]</a><span class="k">class</span> <span class="nc">TestMail</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestMail"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.mail.tests.html#evennia.contrib.game_systems.mail.tests.TestMail">[docs]</a><span class="k">class</span> <span class="nc">TestMail</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestMail.test_mail"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.mail.tests.html#evennia.contrib.game_systems.mail.tests.TestMail.test_mail">[docs]</a> <span class="k">def</span> <span class="nf">test_mail</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">mail</span><span class="o">.</span><span class="n">CmdMail</span><span class="p">(),</span> <span class="s2">&quot;2&quot;</span><span class="p">,</span> <span class="s2">&quot;&#39;2&#39; is not a valid mail id.&quot;</span><span class="p">,</span> <span class="n">caller</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">account</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">mail</span><span class="o">.</span><span class="n">CmdMail</span><span class="p">(),</span> <span class="s2">&quot;test&quot;</span><span class="p">,</span> <span class="s2">&quot;&#39;test&#39; is not a valid mail id.&quot;</span><span class="p">,</span> <span class="n">caller</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">account</span><span class="p">)</span>

View file

@ -47,11 +47,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">multidescer</span>
<div class="viewcode-block" id="TestMultidescer"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.multidescer.tests.html#evennia.contrib.game_systems.multidescer.tests.TestMultidescer">[docs]</a><span class="k">class</span> <span class="nc">TestMultidescer</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestMultidescer"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.multidescer.tests.html#evennia.contrib.game_systems.multidescer.tests.TestMultidescer">[docs]</a><span class="k">class</span> <span class="nc">TestMultidescer</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestMultidescer.test_cmdmultidesc"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.multidescer.tests.html#evennia.contrib.game_systems.multidescer.tests.TestMultidescer.test_cmdmultidesc">[docs]</a> <span class="k">def</span> <span class="nf">test_cmdmultidesc</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">multidescer</span><span class="o">.</span><span class="n">CmdMultiDesc</span><span class="p">(),</span> <span class="s2">&quot;/list&quot;</span><span class="p">,</span> <span class="s2">&quot;Stored descs:</span><span class="se">\n</span><span class="s2">caller:&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>

View file

@ -53,12 +53,12 @@
<span class="kn">import</span> <span class="nn">itertools</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">search</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">puzzles</span>
<div class="viewcode-block" id="TestPuzzles"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.puzzles.tests.html#evennia.contrib.game_systems.puzzles.tests.TestPuzzles">[docs]</a><span class="k">class</span> <span class="nc">TestPuzzles</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestPuzzles"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.puzzles.tests.html#evennia.contrib.game_systems.puzzles.tests.TestPuzzles">[docs]</a><span class="k">class</span> <span class="nc">TestPuzzles</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestPuzzles.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.puzzles.tests.html#evennia.contrib.game_systems.puzzles.tests.TestPuzzles.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">TestPuzzles</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">steel</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">object_typeclass</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;steel&quot;</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">location</span><span class="p">)</span>

View file

@ -48,14 +48,14 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span><span class="p">,</span> <span class="n">MagicMock</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">DefaultRoom</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">tb_basic</span><span class="p">,</span> <span class="n">tb_equip</span><span class="p">,</span> <span class="n">tb_range</span><span class="p">,</span> <span class="n">tb_items</span><span class="p">,</span> <span class="n">tb_magic</span>
<div class="viewcode-block" id="TestTurnBattleBasicCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleBasicCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleBasicCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleBasicCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="c1"># Test basic combat commands</span>
<div class="viewcode-block" id="TestTurnBattleBasicCmd.test_turnbattlecmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd.test_turnbattlecmd">[docs]</a> <span class="k">def</span> <span class="nf">test_turnbattlecmd</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
@ -66,7 +66,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">tb_basic</span><span class="o">.</span><span class="n">CmdRest</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Char rests to recover HP.&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestTurnBattleEquipCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleEquipCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleEquipCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleEquipCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleEquipCmd.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">TestTurnBattleEquipCmd</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">testweapon</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">tb_equip</span><span class="o">.</span><span class="n">TBEWeapon</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;test weapon&quot;</span><span class="p">)</span>
@ -89,7 +89,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">tb_equip</span><span class="o">.</span><span class="n">CmdRest</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Char rests to recover HP.&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestTurnBattleRangeCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleRangeCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleRangeCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleRangeCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="c1"># Test range commands</span>
<div class="viewcode-block" id="TestTurnBattleRangeCmd.test_turnbattlerangecmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd.test_turnbattlerangecmd">[docs]</a> <span class="k">def</span> <span class="nf">test_turnbattlerangecmd</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="c1"># Start with range module specific commands.</span>
@ -105,7 +105,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">tb_range</span><span class="o">.</span><span class="n">CmdRest</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Char rests to recover HP.&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestTurnBattleItemsCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleItemsCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleItemsCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleItemsCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleItemsCmd.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">TestTurnBattleItemsCmd</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">testitem</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="s2">&quot;test item&quot;</span><span class="p">)</span>
@ -122,7 +122,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">tb_items</span><span class="o">.</span><span class="n">CmdRest</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;Char rests to recover HP.&quot;</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestTurnBattleMagicCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleMagicCmd</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTurnBattleMagicCmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd">[docs]</a><span class="k">class</span> <span class="nc">TestTurnBattleMagicCmd</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="c1"># Test magic commands</span>
<div class="viewcode-block" id="TestTurnBattleMagicCmd.test_turnbattlemagiccmd"><a class="viewcode-back" href="../../../../../api/evennia.contrib.game_systems.turnbattle.tests.html#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd.test_turnbattlemagiccmd">[docs]</a> <span class="k">def</span> <span class="nf">test_turnbattlemagiccmd</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

View file

@ -50,7 +50,7 @@
<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span><span class="p">,</span> <span class="n">Mock</span>
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">DefaultRoom</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">extended_room</span>
@ -68,7 +68,7 @@
<div class="viewcode-block" id="TestExtendedRoom"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.extended_room.tests.html#evennia.contrib.grid.extended_room.tests.TestExtendedRoom">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.contrib.grid.extended_room.extended_room.datetime.datetime&quot;</span><span class="p">,</span> <span class="n">ForceUTCDatetime</span><span class="p">)</span>
<span class="c1"># mock gametime to return April 9, 2064, at 21:06 (spring evening)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.utils.gametime.gametime&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">Mock</span><span class="p">(</span><span class="n">return_value</span><span class="o">=</span><span class="mi">2975000766</span><span class="p">))</span>
<span class="k">class</span> <span class="nc">TestExtendedRoom</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TestExtendedRoom</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<span class="n">room_typeclass</span> <span class="o">=</span> <span class="n">extended_room</span><span class="o">.</span><span class="n">ExtendedRoom</span>
<span class="n">DETAIL_DESC</span> <span class="o">=</span> <span class="s2">&quot;A test detail.&quot;</span>
<span class="n">SPRING_DESC</span> <span class="o">=</span> <span class="s2">&quot;A spring description.&quot;</span>

View file

@ -48,11 +48,11 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">simpledoor</span>
<div class="viewcode-block" id="TestSimpleDoor"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.simpledoor.tests.html#evennia.contrib.grid.simpledoor.tests.TestSimpleDoor">[docs]</a><span class="k">class</span> <span class="nc">TestSimpleDoor</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSimpleDoor"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.simpledoor.tests.html#evennia.contrib.grid.simpledoor.tests.TestSimpleDoor">[docs]</a><span class="k">class</span> <span class="nc">TestSimpleDoor</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSimpleDoor.test_cmdopen"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.simpledoor.tests.html#evennia.contrib.grid.simpledoor.tests.TestSimpleDoor.test_cmdopen">[docs]</a> <span class="k">def</span> <span class="nf">test_cmdopen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span>
<span class="n">simpledoor</span><span class="o">.</span><span class="n">CmdOpen</span><span class="p">(),</span>

View file

@ -48,7 +48,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span><span class="p">,</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">slow_exit</span>
@ -60,7 +60,7 @@
<span class="k">return</span> <span class="n">Mock</span><span class="p">()</span>
<div class="viewcode-block" id="TestSlowExit"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.slow_exit.tests.html#evennia.contrib.grid.slow_exit.tests.TestSlowExit">[docs]</a><span class="k">class</span> <span class="nc">TestSlowExit</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSlowExit"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.slow_exit.tests.html#evennia.contrib.grid.slow_exit.tests.TestSlowExit">[docs]</a><span class="k">class</span> <span class="nc">TestSlowExit</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestSlowExit.test_exit"><a class="viewcode-back" href="../../../../../api/evennia.contrib.grid.slow_exit.tests.html#evennia.contrib.grid.slow_exit.tests.TestSlowExit.test_exit">[docs]</a> <span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.utils.delay&quot;</span><span class="p">,</span> <span class="n">_cancellable_mockdelay</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">test_exit</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">exi</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span>

View file

@ -47,13 +47,13 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">dice</span>
<div class="viewcode-block" id="TestDice"><a class="viewcode-back" href="../../../../../api/evennia.contrib.rpg.dice.tests.html#evennia.contrib.rpg.dice.tests.TestDice">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.contrib.rpg.dice.dice.randint&quot;</span><span class="p">,</span> <span class="n">return_value</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">TestDice</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<span class="k">class</span> <span class="nc">TestDice</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestDice.test_roll_dice"><a class="viewcode-back" href="../../../../../api/evennia.contrib.rpg.dice.tests.html#evennia.contrib.rpg.dice.tests.TestDice.test_roll_dice">[docs]</a> <span class="k">def</span> <span class="nf">test_roll_dice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mocked_randint</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">dice</span><span class="o">.</span><span class="n">roll_dice</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">modifier</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;+&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)),</span> <span class="n">mocked_randint</span><span class="p">()</span> <span class="o">*</span> <span class="mi">6</span> <span class="o">+</span> <span class="mi">4</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">dice</span><span class="o">.</span><span class="n">roll_dice</span><span class="p">(</span><span class="mi">6</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">conditional</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;&lt;&quot;</span><span class="p">,</span> <span class="mi">35</span><span class="p">)),</span> <span class="kc">True</span><span class="p">)</span>

View file

@ -48,7 +48,7 @@
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">time</span>
<span class="kn">from</span> <span class="nn">anything</span> <span class="kn">import</span> <span class="n">Anything</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">create_object</span>
@ -322,7 +322,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="p">(</span><span class="n">Anything</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">speaker</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">speaker</span><span class="o">.</span><span class="n">key</span><span class="p">))</span></div></div>
<div class="viewcode-block" id="TestRPSystemCommands"><a class="viewcode-back" href="../../../../../api/evennia.contrib.rpg.rpsystem.tests.html#evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestRPSystemCommands</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestRPSystemCommands"><a class="viewcode-back" href="../../../../../api/evennia.contrib.rpg.rpsystem.tests.html#evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands">[docs]</a><span class="k">class</span> <span class="nc">TestRPSystemCommands</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestRPSystemCommands.setUp"><a class="viewcode-back" href="../../../../../api/evennia.contrib.rpg.rpsystem.tests.html#evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands.setUp">[docs]</a> <span class="k">def</span> <span class="nf">setUp</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">setUp</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">swap_typeclass</span><span class="p">(</span><span class="n">rpsystem</span><span class="o">.</span><span class="n">ContribRPCharacter</span><span class="p">)</span>

View file

@ -46,12 +46,12 @@
<span class="sd">Tutorial - talking NPC tests.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">talking_npc</span>
<div class="viewcode-block" id="TestTalkingNPC"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.talking_npc.tests.html#evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC">[docs]</a><span class="k">class</span> <span class="nc">TestTalkingNPC</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTalkingNPC"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.talking_npc.tests.html#evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC">[docs]</a><span class="k">class</span> <span class="nc">TestTalkingNPC</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTalkingNPC.test_talkingnpc"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.talking_npc.tests.html#evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC.test_talkingnpc">[docs]</a> <span class="k">def</span> <span class="nf">test_talkingnpc</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">npc</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">talking_npc</span><span class="o">.</span><span class="n">TalkingNPC</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;npctalker&quot;</span><span class="p">,</span> <span class="n">location</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">talking_npc</span><span class="o">.</span><span class="n">CmdTalk</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;(You walk up and talk to Char.)&quot;</span><span class="p">)</span>

View file

@ -50,7 +50,7 @@
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">twisted.trial.unittest</span> <span class="kn">import</span> <span class="n">TestCase</span> <span class="k">as</span> <span class="n">TwistedTestCase</span>
<span class="kn">from</span> <span class="nn">twisted.internet.base</span> <span class="kn">import</span> <span class="n">DelayedCall</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">EvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.tests</span> <span class="kn">import</span> <span class="n">BaseEvenniaCommandTest</span>
<span class="kn">from</span> <span class="nn">evennia.utils.create</span> <span class="kn">import</span> <span class="n">create_object</span>
<span class="kn">from</span> <span class="nn">evennia.utils.test_resources</span> <span class="kn">import</span> <span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">mockdelay</span><span class="p">,</span> <span class="n">mockdeferLater</span>
<span class="kn">from</span> <span class="nn">.</span> <span class="kn">import</span> <span class="n">mob</span><span class="p">,</span> <span class="n">objects</span> <span class="k">as</span> <span class="n">tutobjects</span><span class="p">,</span> <span class="n">rooms</span> <span class="k">as</span> <span class="n">tutrooms</span>
@ -74,7 +74,7 @@
<span class="n">DelayedCall</span><span class="o">.</span><span class="n">debug</span> <span class="o">=</span> <span class="kc">True</span>
<div class="viewcode-block" id="TestTutorialWorldObjects"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects">[docs]</a><span class="k">class</span> <span class="nc">TestTutorialWorldObjects</span><span class="p">(</span><span class="n">TwistedTestCase</span><span class="p">,</span> <span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTutorialWorldObjects"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects">[docs]</a><span class="k">class</span> <span class="nc">TestTutorialWorldObjects</span><span class="p">(</span><span class="n">TwistedTestCase</span><span class="p">,</span> <span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTutorialWorldObjects.test_tutorialobj"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects.test_tutorialobj">[docs]</a> <span class="k">def</span> <span class="nf">test_tutorialobj</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">obj1</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">tutobjects</span><span class="o">.</span><span class="n">TutorialObject</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;tutobj&quot;</span><span class="p">)</span>
<span class="n">obj1</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
@ -173,7 +173,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">tutobjects</span><span class="o">.</span><span class="n">CmdGetWeapon</span><span class="p">(),</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="s2">&quot;You find Rusty sword.&quot;</span><span class="p">,</span> <span class="n">obj</span><span class="o">=</span><span class="n">rack</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="TestTutorialWorldRooms"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms">[docs]</a><span class="k">class</span> <span class="nc">TestTutorialWorldRooms</span><span class="p">(</span><span class="n">EvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTutorialWorldRooms"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms">[docs]</a><span class="k">class</span> <span class="nc">TestTutorialWorldRooms</span><span class="p">(</span><span class="n">BaseEvenniaCommandTest</span><span class="p">):</span>
<div class="viewcode-block" id="TestTutorialWorldRooms.test_cmdtutorial"><a class="viewcode-back" href="../../../../../api/evennia.contrib.tutorials.tutorial_world.tests.html#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms.test_cmdtutorial">[docs]</a> <span class="k">def</span> <span class="nf">test_cmdtutorial</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">room</span> <span class="o">=</span> <span class="n">create_object</span><span class="p">(</span><span class="n">tutrooms</span><span class="o">.</span><span class="n">TutorialRoom</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;tutroom&quot;</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="o">.</span><span class="n">location</span> <span class="o">=</span> <span class="n">room</span>

View file

@ -720,19 +720,25 @@
<span class="n">location</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">location</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="n">destination</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">destination</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">if</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">home</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">nohome</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">home</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">except</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">:</span>
<span class="k">if</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="n">home</span>
<span class="k">elif</span> <span class="n">nohome</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">home_obj_or_dbref</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="n">dbid_to_obj</span><span class="p">(</span><span class="n">home_obj_or_dbref</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">except</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">:</span>
<span class="k">if</span> <span class="n">settings</span><span class="o">.</span><span class="n">_TEST_ENVIRONMENT</span><span class="p">:</span>
<span class="c1"># this happens for databases where the #1 location is flushed during tests</span>
<span class="n">home</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">DoesNotExist</span><span class="p">(</span>
<span class="s2">&quot;settings.DEFAULT_HOME (= &#39;</span><span class="si">%s</span><span class="s2">&#39;) does not exist, or the setting is malformed.&quot;</span>
<span class="o">%</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span>
<span class="sa">f</span><span class="s2">&quot;settings.DEFAULT_HOME (= &#39;</span><span class="si">{</span><span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_HOME</span><span class="si">}</span><span class="s2">&#39;) does not exist, &quot;</span>
<span class="s2">&quot;or the setting is malformed.&quot;</span>
<span class="p">)</span>
<span class="k">elif</span> <span class="n">nohome</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">home</span><span class="p">:</span>
<span class="n">home</span> <span class="o">=</span> <span class="kc">None</span>
<span class="c1"># create new instance</span>
<span class="n">new_object</span> <span class="o">=</span> <span class="n">typeclass</span><span class="p">(</span>

View file

@ -45,12 +45,34 @@
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Various helper resources for writing unittests.</span>
<span class="sd">Classes for testing Evennia core:</span>
<span class="sd">- `BaseEvenniaTestCase` - no default objects, only enforced default settings</span>
<span class="sd">- `BaseEvenniaTest` - all default objects, enforced default settings</span>
<span class="sd">- `BaseEvenniaCommandTest` - for testing Commands, enforced default settings</span>
<span class="sd">Classes for testing game folder content:</span>
<span class="sd">- `EvenniaTestCase` - no default objects, using gamedir settings (identical to</span>
<span class="sd"> standard Python TestCase)</span>
<span class="sd">- `EvenniaTest` - all default objects, using gamedir settings</span>
<span class="sd">- `EvenniaCommandTest` - for testing game folder commands, using gamedir settings</span>
<span class="sd">Other:</span>
<span class="sd">- `EvenniaTestMixin` - A class mixin for creating the test environment objects, for</span>
<span class="sd"> making custom tests.</span>
<span class="sd">- `EvenniaCommandMixin` - A class mixin that adds support for command testing with the .call()</span>
<span class="sd"> helper. Used by the command-test classes, but can be used for making a customt test class.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">types</span>
<span class="kn">from</span> <span class="nn">twisted.internet.defer</span> <span class="kn">import</span> <span class="n">Deferred</span>
<span class="kn">from</span> <span class="nn">django.conf</span> <span class="kn">import</span> <span class="n">settings</span>
<span class="kn">from</span> <span class="nn">django.test</span> <span class="kn">import</span> <span class="n">TestCase</span><span class="p">,</span> <span class="n">override_settings</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span><span class="p">,</span> <span class="n">patch</span>
<span class="kn">from</span> <span class="nn">mock</span> <span class="kn">import</span> <span class="n">Mock</span><span class="p">,</span> <span class="n">patch</span><span class="p">,</span> <span class="n">MagicMock</span>
<span class="kn">from</span> <span class="nn">evennia.objects.objects</span> <span class="kn">import</span> <span class="n">DefaultObject</span><span class="p">,</span> <span class="n">DefaultCharacter</span><span class="p">,</span> <span class="n">DefaultRoom</span><span class="p">,</span> <span class="n">DefaultExit</span>
<span class="kn">from</span> <span class="nn">evennia.accounts.accounts</span> <span class="kn">import</span> <span class="n">DefaultAccount</span>
<span class="kn">from</span> <span class="nn">evennia.scripts.scripts</span> <span class="kn">import</span> <span class="n">DefaultScript</span>
@ -58,8 +80,14 @@
<span class="kn">from</span> <span class="nn">evennia.server.sessionhandler</span> <span class="kn">import</span> <span class="n">SESSIONS</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">create</span>
<span class="kn">from</span> <span class="nn">evennia.utils.idmapper.models</span> <span class="kn">import</span> <span class="n">flush_cache</span>
<span class="kn">from</span> <span class="nn">evennia.utils.utils</span> <span class="kn">import</span> <span class="n">all_from_module</span>
<span class="kn">from</span> <span class="nn">evennia.utils.utils</span> <span class="kn">import</span> <span class="n">all_from_module</span><span class="p">,</span> <span class="n">to_str</span>
<span class="kn">from</span> <span class="nn">evennia.utils</span> <span class="kn">import</span> <span class="n">ansi</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">settings_default</span>
<span class="kn">from</span> <span class="nn">evennia.commands.default.muxcommand</span> <span class="kn">import</span> <span class="n">MuxCommand</span>
<span class="kn">from</span> <span class="nn">evennia.commands.command</span> <span class="kn">import</span> <span class="n">InterruptCommand</span>
<span class="n">_RE_STRIP_EVMENU</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">r</span><span class="s2">&quot;^\+|-+\+|\+-+|--+|\|(?:\s|$)&quot;</span><span class="p">,</span> <span class="n">re</span><span class="o">.</span><span class="n">MULTILINE</span><span class="p">)</span>
<span class="c1"># set up a &#39;pristine&#39; setting, unaffected by any changes in mygame</span>
@ -102,6 +130,8 @@
<span class="n">FUNCPARSER_PROTOTYPE_PARSING_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.prototypes.protfuncs&quot;</span><span class="p">,</span>
<span class="s2">&quot;evennia.game_template.server.conf.prototypefuncs&quot;</span><span class="p">],</span>
<span class="n">BASE_GUEST_TYPECLASS</span><span class="o">=</span><span class="s2">&quot;evennia.accounts.accounts.DefaultGuest&quot;</span><span class="p">,</span>
<span class="c1"># a special flag; test with settings._TEST_ENVIRONMENT to see if code runs in a test</span>
<span class="n">_TEST_ENVIRONMENT</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span>
<span class="n">DEFAULT_SETTINGS</span> <span class="o">=</span> <span class="p">{</span>
@ -197,7 +227,8 @@
<span class="bp">self</span><span class="o">.</span><span class="n">account2</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span></div>
<span class="c1"># Set up fake prototype module for allowing tests to use named prototypes.</span>
<div class="viewcode-block" id="EvenniaTestMixin.create_rooms"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin.create_rooms">[docs]</a> <span class="nd">@override_settings</span><span class="p">(</span><span class="n">PROTOTYPE_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.utils.tests.data.prototypes_example&quot;</span><span class="p">],</span> <span class="n">DEFAULT_HOME</span><span class="o">=</span><span class="s2">&quot;#1&quot;</span><span class="p">)</span>
<div class="viewcode-block" id="EvenniaTestMixin.create_rooms"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin.create_rooms">[docs]</a> <span class="nd">@override_settings</span><span class="p">(</span><span class="n">PROTOTYPE_MODULES</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;evennia.utils.tests.data.prototypes_example&quot;</span><span class="p">],</span>
<span class="n">DEFAULT_HOME</span><span class="o">=</span><span class="s2">&quot;#1&quot;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">create_rooms</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">room1</span> <span class="o">=</span> <span class="n">create</span><span class="o">.</span><span class="n">create_object</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">room_typeclass</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">&quot;Room&quot;</span><span class="p">,</span> <span class="n">nohome</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">room1</span><span class="o">.</span><span class="n">db</span><span class="o">.</span><span class="n">desc</span> <span class="o">=</span> <span class="s2">&quot;room_desc&quot;</span>
@ -283,14 +314,275 @@
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">tearDown</span><span class="p">()</span></div></div>
<div class="viewcode-block" id="EvenniaCommandTestMixin"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.server.portal.portal.LoopingCall&quot;</span><span class="p">,</span> <span class="n">new</span><span class="o">=</span><span class="n">MagicMock</span><span class="p">())</span>
<span class="k">class</span> <span class="nc">EvenniaCommandTestMixin</span><span class="p">:</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Mixin to add to a test in order to provide the `.call` helper for</span>
<span class="sd"> testing the execution and returns of a command.</span>
<span class="sd"> Tests a Command by running it and comparing what messages it sends with</span>
<span class="sd"> expected values. This tests without actually spinning up the cmdhandler</span>
<span class="sd"> for every test, which is more controlled.</span>
<span class="sd"> Example:</span>
<span class="sd"> ::</span>
<span class="sd"> from commands.echo import CmdEcho</span>
<span class="sd"> class MyCommandTest(EvenniaTest, CommandTestMixin):</span>
<span class="sd"> def test_echo(self):</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="sd"> self.call(MyCommand(), &quot;hello world!&quot;,</span>
<span class="sd"> &quot;You hear your echo: &#39;Hello world!&#39;&quot;)</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># formatting for .call&#39;s error message</span>
<span class="n">_ERROR_FORMAT</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="s2">=========================== Wanted message ===================================</span>
<span class="si">{expected_msg}</span><span class="s2"></span>
<span class="s2">=========================== Returned message =================================</span>
<span class="si">{returned_msg}</span><span class="s2"></span>
<span class="s2">==============================================================================</span>
<span class="s2">&quot;&quot;&quot;</span><span class="o">.</span><span class="n">rstrip</span><span class="p">()</span>
<div class="viewcode-block" id="EvenniaCommandTestMixin.call"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call">[docs]</a> <span class="k">def</span> <span class="nf">call</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">cmdobj</span><span class="p">,</span>
<span class="n">input_args</span><span class="p">,</span>
<span class="n">msg</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdset</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">noansi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">caller</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">receiver</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">cmdstring</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">obj</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">inputs</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">raw_string</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Test a command by assigning all the needed properties to a cmdobj and</span>
<span class="sd"> running the sequence. The resulting `.msg` calls will be mocked and</span>
<span class="sd"> the text= calls to them compared to a expected output.</span>
<span class="sd"> Args:</span>
<span class="sd"> cmdobj (Command): The command object to use.</span>
<span class="sd"> input_args (str): This should be the full input the Command should</span>
<span class="sd"> see, such as &#39;look here&#39;. This will become `.args` for the Command</span>
<span class="sd"> instance to parse.</span>
<span class="sd"> msg (str or dict, optional): This is the expected return value(s)</span>
<span class="sd"> returned through `caller.msg(text=...)` calls in the command. If a string, the</span>
<span class="sd"> receiver is controlled with the `receiver` kwarg (defaults to `caller`).</span>
<span class="sd"> If this is a `dict`, it is a mapping</span>
<span class="sd"> `{receiver1: &quot;expected1&quot;, receiver2: &quot;expected2&quot;,...}` and `receiver` is</span>
<span class="sd"> ignored. The message(s) are compared with the actual messages returned</span>
<span class="sd"> to the receiver(s) as the Command runs. Each check uses `.startswith`,</span>
<span class="sd"> so you can choose to only include the first part of the</span>
<span class="sd"> returned message if that&#39;s enough to verify a correct result. EvMenu</span>
<span class="sd"> decorations (like borders) are stripped and should not be included. This</span>
<span class="sd"> should also not include color tags unless `noansi=False`.</span>
<span class="sd"> If the command returns texts in multiple separate `.msg`-</span>
<span class="sd"> calls to a receiver, separate these with `|` if `noansi=True`</span>
<span class="sd"> (default) and `||` if `noansi=False`. If no `msg` is given (`None`),</span>
<span class="sd"> then no automatic comparison will be done.</span>
<span class="sd"> cmdset (str, optional): If given, make `.cmdset` available on the Command</span>
<span class="sd"> instance as it runs. While `.cmdset` is normally available on the</span>
<span class="sd"> Command instance by default, this is usually only used by</span>
<span class="sd"> commands that explicitly operates/displays cmdsets, like</span>
<span class="sd"> `examine`.</span>
<span class="sd"> noansi (str, optional): By default the color tags of the `msg` is</span>
<span class="sd"> ignored, this makes them significant. If unset, `msg` must contain</span>
<span class="sd"> the same color tags as the actual return message.</span>
<span class="sd"> caller (Object or Account, optional): By default `self.char1` is used as the</span>
<span class="sd"> command-caller (the `.caller` property on the Command). This allows to</span>
<span class="sd"> execute with another caller, most commonly an Account.</span>
<span class="sd"> receiver (Object or Account, optional): This is the object to receive the</span>
<span class="sd"> return messages we want to test. By default this is the same as `caller`</span>
<span class="sd"> (which in turn defaults to is `self.char1`). Note that if `msg` is</span>
<span class="sd"> a `dict`, this is ignored since the receiver is already specified there.</span>
<span class="sd"> cmdstring (str, optional): Normally this is the Command&#39;s `key`.</span>
<span class="sd"> This allows for tweaking the `.cmdname` property of the</span>
<span class="sd"> Command`. This isb used for commands with multiple aliases,</span>
<span class="sd"> where the command explicitly checs which alias was used to</span>
<span class="sd"> determine its functionality.</span>
<span class="sd"> obj (str, optional): This sets the `.obj` property of the Command - the</span>
<span class="sd"> object on which the Command &#39;sits&#39;. By default this is the same as `caller`.</span>
<span class="sd"> This can be used for testing on-object Command interactions.</span>
<span class="sd"> inputs (list, optional): A list of strings to pass to functions that pause to</span>
<span class="sd"> take input from the user (normally using `@interactive` and</span>
<span class="sd"> `ret = yield(question)` or `evmenu.get_input`). Each element of the</span>
<span class="sd"> list will be passed into the command as if the user wrote that at the prompt.</span>
<span class="sd"> raw_string (str, optional): Normally the `.raw_string` property is set as</span>
<span class="sd"> a combination of your `key/cmdname` and `input_args`. This allows</span>
<span class="sd"> direct control of what this is, for example for testing edge cases</span>
<span class="sd"> or malformed inputs.</span>
<span class="sd"> Returns:</span>
<span class="sd"> str or dict: The message sent to `receiver`, or a dict of</span>
<span class="sd"> `{receiver: &quot;msg&quot;, ...}` if multiple are given. This is usually</span>
<span class="sd"> only used with `msg=None` to do the validation externally.</span>
<span class="sd"> Raises:</span>
<span class="sd"> AssertionError: If the returns of `.msg` calls (tested with `.startswith`) does not</span>
<span class="sd"> match `expected_input`.</span>
<span class="sd"> Notes:</span>
<span class="sd"> As part of the tests, all methods of the Command will be called in</span>
<span class="sd"> the proper order:</span>
<span class="sd"> - cmdobj.at_pre_cmd()</span>
<span class="sd"> - cmdobj.parse()</span>
<span class="sd"> - cmdobj.func()</span>
<span class="sd"> - cmdobj.at_post_cmd()</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># The `self.char1` is created in the `EvenniaTest` base along with</span>
<span class="c1"># other helper objects like self.room and self.obj</span>
<span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">caller</span> <span class="o">=</span> <span class="n">caller</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="o">=</span> <span class="n">cmdstring</span> <span class="k">if</span> <span class="n">cmdstring</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_cmdname</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdstring</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdname</span> <span class="c1"># deprecated</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">args</span> <span class="o">=</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">cmdset</span> <span class="o">=</span> <span class="n">cmdset</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">session</span> <span class="o">=</span> <span class="n">SESSIONS</span><span class="o">.</span><span class="n">session_from_sessid</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">account</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">account</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">raw_string</span> <span class="o">=</span> <span class="n">raw_string</span> <span class="k">if</span> <span class="n">raw_string</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">key</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="n">input_args</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">obj</span> <span class="o">=</span> <span class="n">obj</span> <span class="ow">or</span> <span class="p">(</span><span class="n">caller</span> <span class="k">if</span> <span class="n">caller</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">char1</span><span class="p">)</span>
<span class="n">inputs</span> <span class="o">=</span> <span class="n">inputs</span> <span class="ow">or</span> <span class="p">[]</span>
<span class="c1"># set up receivers</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
<span class="c1"># a mapping {receiver: msg, ...}</span>
<span class="n">receiver_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="n">recv</span><span class="p">:</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">recv</span><span class="p">,</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">msg</span><span class="o">.</span><span class="n">items</span><span class="p">()}</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># a single expected string and thus a single receiver (defaults to caller)</span>
<span class="n">receiver</span> <span class="o">=</span> <span class="n">receiver</span> <span class="k">if</span> <span class="n">receiver</span> <span class="k">else</span> <span class="n">caller</span>
<span class="n">receiver_mapping</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">msg</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">unmocked_msg_methods</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="p">:</span>
<span class="c1"># save the old .msg method so we can get it back</span>
<span class="c1"># cleanly after the test</span>
<span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span>
<span class="c1"># replace normal `.msg` with a mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">Mock</span><span class="p">()</span>
<span class="c1"># Run the methods of the Command. This mimics what happens in the</span>
<span class="c1"># cmdhandler. This will have the mocked .msg be called as part of the</span>
<span class="c1"># execution. Mocks remembers what was sent to them so we will be able</span>
<span class="c1"># to retrieve what was sent later.</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">at_pre_cmd</span><span class="p">():</span>
<span class="k">return</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">parse</span><span class="p">()</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">cmdobj</span><span class="o">.</span><span class="n">func</span><span class="p">()</span>
<span class="c1"># handle func&#39;s with yield in them (making them generators)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">types</span><span class="o">.</span><span class="n">GeneratorType</span><span class="p">):</span>
<span class="k">while</span> <span class="kc">True</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">inp</span> <span class="o">=</span> <span class="n">inputs</span><span class="o">.</span><span class="n">pop</span><span class="p">()</span> <span class="k">if</span> <span class="n">inputs</span> <span class="k">else</span> <span class="kc">None</span>
<span class="k">if</span> <span class="n">inp</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="c1"># this mimics a user&#39;s reply to a prompt</span>
<span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">ret</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># non-input yield, like yield(10). We don&#39;t pause</span>
<span class="c1"># but fire it immediately.</span>
<span class="nb">next</span><span class="p">(</span><span class="n">ret</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">break</span>
<span class="n">cmdobj</span><span class="o">.</span><span class="n">at_post_cmd</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">StopIteration</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">except</span> <span class="n">InterruptCommand</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">for</span> <span class="n">inp</span> <span class="ow">in</span> <span class="n">inputs</span><span class="p">:</span>
<span class="c1"># if there are any inputs left, we may have a non-generator</span>
<span class="c1"># input to handle (get_input/ask_yes_no that uses a separate</span>
<span class="c1"># cmdset rather than a yield</span>
<span class="n">caller</span><span class="o">.</span><span class="n">execute_cmd</span><span class="p">(</span><span class="n">inp</span><span class="p">)</span>
<span class="c1"># At this point the mocked .msg methods on each receiver will have</span>
<span class="c1"># stored all calls made to them (that&#39;s a basic function of the Mock</span>
<span class="c1"># class). We will not extract them and compare to what we expected to</span>
<span class="c1"># go to each receiver.</span>
<span class="n">returned_msgs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">receiver</span><span class="p">,</span> <span class="n">expected_msg</span> <span class="ow">in</span> <span class="n">receiver_mapping</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="c1"># get the stored messages from the Mock with Mock.mock_calls.</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="n">args</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">else</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;text&quot;</span><span class="p">,</span> <span class="n">to_str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">))</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span> <span class="ow">in</span> <span class="n">receiver</span><span class="o">.</span><span class="n">msg</span><span class="o">.</span><span class="n">mock_calls</span>
<span class="p">]</span>
<span class="c1"># we can return this now, we are done using the mock</span>
<span class="n">receiver</span><span class="o">.</span><span class="n">msg</span> <span class="o">=</span> <span class="n">unmocked_msg_methods</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span>
<span class="c1"># Get the first element of a tuple if msg received a tuple instead of a string</span>
<span class="n">stored_msg</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">smsg</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)</span> <span class="k">else</span> <span class="nb">str</span><span class="p">(</span><span class="n">smsg</span><span class="p">)</span> <span class="k">for</span> <span class="n">smsg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">]</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="c1"># no expected_msg; just build the returned_msgs dict</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> <span class="k">for</span> <span class="n">msg</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">returned_msg</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="c1"># compare messages to expected</span>
<span class="c1"># set our separator for returned messages based on parsing ansi or not</span>
<span class="n">msg_sep</span> <span class="o">=</span> <span class="s2">&quot;|&quot;</span> <span class="k">if</span> <span class="n">noansi</span> <span class="k">else</span> <span class="s2">&quot;||&quot;</span>
<span class="c1"># We remove Evmenu decorations since that just makes it harder</span>
<span class="c1"># to write the comparison string. We also strip ansi before this</span>
<span class="c1"># comparison since otherwise it would mess with the regex.</span>
<span class="n">returned_msg</span> <span class="o">=</span> <span class="n">msg_sep</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
<span class="n">_RE_STRIP_EVMENU</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span>
<span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="n">ansi</span><span class="o">.</span><span class="n">parse_ansi</span><span class="p">(</span><span class="n">mess</span><span class="p">,</span> <span class="n">strip_ansi</span><span class="o">=</span><span class="n">noansi</span><span class="p">))</span>
<span class="k">for</span> <span class="n">mess</span> <span class="ow">in</span> <span class="n">stored_msg</span><span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="c1"># this is the actual test</span>
<span class="k">if</span> <span class="n">expected_msg</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="ow">and</span> <span class="n">returned_msg</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">returned_msg</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">expected_msg</span><span class="p">):</span>
<span class="c1"># failed the test</span>
<span class="k">raise</span> <span class="ne">AssertionError</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_ERROR_FORMAT</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">expected_msg</span><span class="o">=</span><span class="n">expected_msg</span><span class="p">,</span> <span class="n">returned_msg</span><span class="o">=</span><span class="n">returned_msg</span><span class="p">)</span>
<span class="p">)</span>
<span class="c1"># passed!</span>
<span class="n">returned_msgs</span><span class="p">[</span><span class="n">receiver</span><span class="p">]</span> <span class="o">=</span> <span class="n">returned_msg</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">returned_msgs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">returned_msgs</span><span class="o">.</span><span class="n">values</span><span class="p">())[</span><span class="mi">0</span><span class="p">]</span>
<span class="k">return</span> <span class="n">returned_msgs</span></div></div>
<span class="c1"># Base testing classes</span>
<div class="viewcode-block" id="BaseEvenniaTestCase"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTestCase">[docs]</a><span class="nd">@override_settings</span><span class="p">(</span><span class="o">**</span><span class="n">DEFAULT_SETTINGS</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaTestCase</span><span class="p">(</span><span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Base test (with no default objects) but with</span>
<span class="sd"> enforced default settings.</span>
<span class="sd"> Base test (with no default objects) but with enforced default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaTestCase"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestCase">[docs]</a><span class="k">class</span> <span class="nc">EvenniaTestCase</span><span class="p">(</span><span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> For use with gamedir settings; Just like the normal test case, only for naming consistency.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">pass</span></div>
<div class="viewcode-block" id="BaseEvenniaTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest">[docs]</a><span class="nd">@override_settings</span><span class="p">(</span><span class="o">**</span><span class="n">DEFAULT_SETTINGS</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaTest</span><span class="p">(</span><span class="n">EvenniaTestMixin</span><span class="p">,</span> <span class="n">TestCase</span><span class="p">):</span>
@ -299,7 +591,6 @@
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest">[docs]</a><span class="k">class</span> <span class="nc">EvenniaTest</span><span class="p">(</span><span class="n">EvenniaTestMixin</span><span class="p">,</span> <span class="n">TestCase</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> This test class is intended for inheriting in mygame tests.</span>
@ -314,6 +605,31 @@
<span class="n">exit_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_EXIT_TYPECLASS</span>
<span class="n">room_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_ROOM_TYPECLASS</span>
<span class="n">script_typeclass</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">BASE_SCRIPT_TYPECLASS</span></div>
<div class="viewcode-block" id="BaseEvenniaCommandTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest">[docs]</a><span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.account.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.admin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.batchprocess.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.building.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.comms.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.general.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.help.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.syscommands.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.system.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="nd">@patch</span><span class="p">(</span><span class="s2">&quot;evennia.commands.unloggedin.COMMAND_DEFAULT_CLASS&quot;</span><span class="p">,</span> <span class="n">MuxCommand</span><span class="p">)</span>
<span class="k">class</span> <span class="nc">BaseEvenniaCommandTest</span><span class="p">(</span><span class="n">BaseEvenniaTest</span><span class="p">,</span> <span class="n">EvenniaCommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Commands only using the default settings.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="EvenniaCommandTest"><a class="viewcode-back" href="../../../api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTest">[docs]</a><span class="k">class</span> <span class="nc">EvenniaCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">EvenniaCommandTestMixin</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Parent class to inherit from - makes tests use your own</span>
<span class="sd"> classes and settings in mygame.</span>
<span class="sd"> &quot;&quot;&quot;</span></div>
</pre></div>
<div class="clearer"></div>

View file

@ -1,6 +1,5 @@
# Unit Testing
*Unit testing* means testing components of a program in isolation from each other to make sure every
part works on its own before using it with others. Extensive testing helps avoid new updates causing
unexpected side effects as well as alleviates general code rot (a more comprehensive wikipedia
@ -31,9 +30,9 @@ how many tests were run and how long it took. If something went wrong you will g
If you contribute to Evennia, this is a useful sanity check to see you haven't introduced an
unexpected bug.
## Running tests with custom settings file
## Running tests for your game dir
If you have implemented your own tests for your game (see below) you can run them from your game dir
If you have implemented your own tests for your game you can run them from your game dir
with
evennia test .
@ -41,8 +40,8 @@ with
The period (`.`) means to run all tests found in the current directory and all subdirectories. You
could also specify, say, `typeclasses` or `world` if you wanted to just run tests in those subdirs.
Those tests will all be run using the default settings. To run the tests with your own settings file
you must use the `--settings` option:
An important thing to note is that those tests will all be run using the _default Evennia settings_.
To run the tests with your own settings file you must use the `--settings` option:
evennia test --settings settings.py .
@ -50,108 +49,184 @@ The `--settings` option of Evennia takes a file name in the `mygame/server/conf`
normally used to swap settings files for testing and development. In combination with `test`, it
forces Evennia to use this settings file over the default one.
You can also test specific things by giving their path
evennia test --settings settings.py .world.tests.YourTest
## Writing new tests
Evennia's test suite makes use of Django unit test system, which in turn relies on Python's
*unittest* module.
> If you want to help out writing unittests for Evennia, take a look at Evennia's [coveralls.io
page](https://coveralls.io/github/evennia/evennia). There you see which modules have any form of
test coverage and which does not.
To make the test runner find the tests, they must be put in a module named `test*.py` (so `test.py`,
`tests.py` etc). Such a test module will be found wherever it is in the package. It can be a good
idea to look at some of Evennia's `tests.py` modules to see how they look.
Inside a testing file, a `unittest.TestCase` class is used to test a single aspect or component in
various ways. Each test case contains one or more *test methods* - these define the actual tests to
run. You can name the test methods anything you want as long as the name starts with "`test_`".
Your `TestCase` class can also have a method `setUp()`. This is run before each test, setting up and
storing whatever preparations the test methods need. Conversely, a `tearDown()` method can
optionally do cleanup after each test.
Inside the module you need to put a class inheriting (at any distance) from `unittest.TestCase`. Each
method on that class that starts with `test_` will be run separately as a unit test. There
are two special, optional methods `setUp` and `tearDown` that will (if you define them) run before
_every_ test. This can be useful for setting up and deleting things.
To test the results, you use special methods of the `TestCase` class. Many of those start with
"`assert`", such as `assertEqual` or `assertTrue`.
To actually test things, you use special `assert...` methods on the class. Most common on is
`assertEqual`, which makes sure a result is what you expect it to be.
Example of a `TestCase` class:
Here's an example of the principle. Let's assume you put this in `mygame/world/tests.py`
and want to test a function in `mygame/world/myfunctions.py`
```python
# in a module tests.py somewhere i your game dir
import unittest
from evennia import create_object
# the function we want to test
from mypath import myfunc
from .myfunctions import myfunc
class TestObj(unittest.TestCase):
"This tests a function myfunc."
def setUp(self):
"""done before every of the test_ * methods below"""
self.obj = create_object("mytestobject")
def tearDown(self):
"""done after every test_* method below """
self.obj.delete()
def test_return_value(self):
"test method. Makes sure return value is as expected."
expected_return = "This is me being nice."
actual_return = myfunc()
"""test method. Makes sure return value is as expected."""
actual_return = myfunc(self.obj)
expected_return = "This is the good object 'mytestobject'."
# test
self.assertEqual(expected_return, actual_return)
def test_alternative_call(self):
"test method. Calls with a keyword argument."
expected_return = "This is me being baaaad."
actual_return = myfunc(bad=True)
"""test method. Calls with a keyword argument."""
actual_return = myfunc(self.obj, bad=True)
expected_return = "This is the baaad object 'mytestobject'."
# test
self.assertEqual(expected_return, actual_return)
```
You might also want to read the [documentation for the unittest
module](https://docs.python.org/library/unittest.html).
To test this, run
### Using the EvenniaTest class
evennia test --settings settings.py .
Evennia offers a custom TestCase, the `evennia.utils.test_resources.EvenniaTest` class. This class
initiates a range of useful properties on themselves for testing Evennia systems. Examples are
`.account` and `.session` representing a mock connected Account and its Session and `.char1` and
`char2` representing Characters complete with a location in the test database. These are all useful
when testing Evennia system requiring any of the default Evennia typeclasses as inputs. See the full
definition of the `EvenniaTest` class in
[evennia/utils/test_resources.py](https://github.com/evennia/evennia/blob/master/evennia/utils/test_resources.py).
to run the entire test module
evennia test --settings setings.py .world.tests
or a specific class:
evennia test --settings settings.py .world.tests.TestObj
You can also run a specific test:
evennia test --settings settings.py .world.tests.TestObj.test_alternative_call
You might also want to read the [Python documentation for the unittest module](https://docs.python.org/library/unittest.html).
## Using the Evennia testing classes
Evennia offers many custom testing classes that helps with testing Evennia features.
They are all found in [evennia.utils.test_resources](evennia.utils.test_resources). Note that
these classes implement the `setUp` and `tearDown` already, so if you want to add stuff in them
yourself you should remember to use e.g. `super().setUp()` in your code.
### Classes for testing your game dir
These all use whatever setting you pass to them and works well for testing code in your game dir.
- `EvenniaTest` - this sets up a full object environment for your test. All the created entities
can be accesses as properties on the class:
- `.account` - A fake [Account](evennia.accounts.accounts.DefaultAccount) named "TestAccount".
- `.account2` - Another account named "TestAccount2"
- `char1` - A [Character](evennia.objects.objects.DefaultCharacter) linked to `.account`, named `Char`.
This has 'Developer' permissions but is not a superuser.
- `.char2` - Another character linked to `account`, named `Char2`. This has base permissions (player).
- `.obj1` - A regular [Object](evennia.objects.objects.DefaultObject) named "Obj".
- `.obj2` - Another object named "Obj2".
- `.room1` - A [Room](evennia.objects.objects.DefaultRoom) named "Room". Both characters and both
objects are located inside this room. It has a description of "room_desc".
- `.room2` - Another room named "Room2". It is empty and has no set description.
- `.exit` - An exit named "out" that leads from `.room1` to `.room2`.
- `.script` - A [Script](evennia.scripts.scripts.DefaultScript) named "Script". It's an inert script
without a timing component.
- `.session` - A fake [Session](evennia.server.serversession.ServerSession) that mimics a player
connecting to the game. It is used by `.account1` and has a sessid of 1.
- `EvenniaCommandTest` - has the same environment like `EvenniaTest` but also adds a special
[.call()](evennia.utils.test_resources.EvenniaCommandTestMixin.call) method specifically for
testing Evennia [Commands](../Components/Commands.md). It allows you to compare what the command _actually_
returns to the player with what you expect. Read the `call` api doc for more info.
- `EvenniaTestCase` - This is identical to the regular Python `TestCase` class, it's
just there for naming symmetry with `BaseEvenniaTestCase` below.
Here's an example of using `EvenniaTest`
```python
# in a test module
from evennia.utils.test_resources import BaseEvenniaTest
from evennia.utils.test_resources import EvenniaTest
class TestObject(BaseEvenniaTest):
def test_object_search(self):
# char1 and char2 are both created in room1
class TestObject(EvenniaTest):
"""Remember that the testing class creates char1 and char2 inside room1 ..."""
def test_object_search_character(self):
"""Check that char1 can search for char2 by name"""
self.assertEqual(self.char1.search(self.char2.key), self.char2)
def test_location_search(self):
"""Check so that char1 can find the current location by name"""
self.assertEqual(self.char1.search(self.char1.location.key), self.char1.location)
# ...
```
### Testing in-game Commands
In-game Commands are a special case. Tests for the default commands are put in
`evennia/commands/default/tests.py`. This uses a custom `CommandTest` class that inherits from
`evennia.utils.test_resources.EvenniaTest` described above. `CommandTest` supplies extra convenience
functions for executing commands and check that their return values (calls of `msg()` returns
expected values. It uses Characters and Sessions generated on the `EvenniaTest` class to call each
class).
Each command tested should have its own `TestCase` class. Inherit this class from the `CommandTest`
class in the same module to get access to the command-specific utilities mentioned.
This example tests a custom command.
```python
from evennia.commands.default.tests import CommandTest
from evennia.commands.default import general
class TestSet(CommandTest):
"tests the look command by simple call, using Char2 as a target"
def test_mycmd_char(self):
self.call(general.CmdLook(), "Char2", "Char2(#7)")
from evennia.commands.default.tests import EvenniaCommandTest
from commands import command as mycommand
class TestSet(EvenniaCommandTest):
"tests the look command by simple call, using Char2 as a target"
def test_mycmd_char(self):
self.call(mycommand.CmdMyLook(), "Char2", "Char2(#7)")
def test_mycmd_room(self):
"tests the look command by simple call, with target as room"
def test_mycmd_room(self):
self.call(general.CmdLook(), "Room",
"Room(#1)\nroom_desc\nExits: out(#3)\n"
"You see: Obj(#4), Obj2(#5), Char2(#7)")
self.call(mycommand.CmdMyLook(), "Room",
"Room(#1)\nroom_desc\nExits: out(#3)\n"
"You see: Obj(#4), Obj2(#5), Char2(#7)")
```
### Unit testing contribs with custom models
When using `.call`, you don't need to specify the entire string; you can just give the beginning
of it and if it matches, that's enough. Use `\n` to denote line breaks and (this is a special for
the `.call` helper), `||` to indicate multiple uses of `.msg()` in the Command. The `.call` helper
has a lot of arguments for mimicing different ways of calling a Command, so make sure to
[read the API docs for .call()](evennia.utils.test_resources.EvenniaCommandTestMixin.call).
### Classes for testing Evennia core
These are used for testing Evennia itself. They provide the same resources as the classes
above but enforce Evennias default settings found in `evennia/settings_default.py`, ignoring
any settings changes in your game dir.
- `BaseEvenniaTest` - all the default objects above but with enforced default settings
- `BaseEvenniaCommandTest` - for testing Commands, but with enforced default settings
- `BaseEvenniaTestCase` - no default objects, only enforced default settings
There are also two special 'mixin' classes. These are uses in the classes above, but may also
be useful if you want to mix your own testing classes:
- `EvenniaTestMixin` - A class mixin that creates all test environment objects.
- `EvenniaCommandMixin` - A class mixin that adds the `.call()` Command-tester helper.
If you want to help out writing unittests for Evennia, take a look at Evennia's [coveralls.io
page](https://coveralls.io/github/evennia/evennia). There you see which modules have any form of
test coverage and which does not. All help is appreciated!
## Unit testing contribs with custom models
A special case is if you were to create a contribution to go to the `evennia/contrib` folder that
uses its [own database models](../Concepts/New-Models.md). The problem with this is that Evennia (and Django) will
@ -216,14 +291,8 @@ class TestMyModel(BaseEvenniaTest):
# test case here
```
### A note on adding new tests
Having an extensive tests suite is very important for avoiding code degradation as Evennia is
developed. Only a small fraction of the Evennia codebase is covered by test suites at this point.
Writing new tests is not hard, it's more a matter of finding the time to do so. So adding new tests
is really an area where everyone can contribute, also with only limited Python skills.
### A note on making the test runner faster
## A note on making the test runner faster
If you have custom models with a large number of migrations, creating the test database can take a
very long time. If you don't require migrations to run for your tests, you can disable them with the
@ -246,156 +315,4 @@ After doing so, you can then run tests without migrations by adding the `--nomig
```
evennia test --settings settings.py --nomigrations .
```
## Testing for Game development (mini-tutorial)
Unit testing can be of paramount importance to game developers. When starting with a new game, it is
recommended to look into unit testing as soon as possible; an already huge game is much harder to
write tests for. The benefits of testing a game aren't different from the ones regarding library
testing. For example it is easy to introduce bugs that affect previously working code. Testing is
there to ensure your project behaves the way it should and continue to do so.
If you have never used unit testing (with Python or another language), you might want to check the
[official Python documentation about unit testing](https://docs.python.org/2/library/unittest.html),
particularly the first section dedicated to a basic example.
### Basic testing using Evennia
Evennia's test runner can be used to launch tests in your game directory (let's call it 'mygame').
Evennia's test runner does a few useful things beyond the normal Python unittest module:
* It creates and sets up an empty database, with some useful objects (accounts, characters and
rooms, among others).
* It provides simple ways to test commands, which can be somewhat tricky at times, if not tested
properly.
Therefore, you should use the command-line to execute the test runner, while specifying your own
game directories (not the one containing evennia). Go to your game directory (referred as 'mygame'
in this section) and execute the test runner:
evennia --settings settings.py test commands
This command will execute Evennia's test runner using your own settings file. It will set up a dummy
database of your choice and look into the 'commands' package defined in your game directory
(`mygame/commands` in this example) to find tests. The test module's name should begin with 'test'
and contain one or more `TestCase`. A full example can be found below.
### A simple example
In your game directory, go to `commands` and create a new file `tests.py` inside (it could be named
anything starting with `test`). We will start by making a test that has nothing to do with Commands,
just to show how unit testing works:
```python
# mygame/commands/tests.py
import unittest
class TestString(unittest.TestCase):
"""Unittest for strings (just a basic example)."""
def test_upper(self):
"""Test the upper() str method."""
self.assertEqual('foo'.upper(), 'FOO')
```
This example, inspired from the Python documentation, is used to test the 'upper()' method of the
'str' class. Not very useful, but it should give you a basic idea of how tests are used.
Let's execute that test to see if it works.
> evennia --settings settings.py test commands
TESTING: Using specified settings file 'server.conf.settings'.
(Obs: Evennia's full test suite may not pass if the settings are very
different from the default. Use 'test .' as arguments to run only tests
on the game dir.)
Creating test database for alias 'default'...
.
----------------------------------------------------------------------
Ran 1 test in 0.001s
OK
Destroying test database for alias 'default'...
We specified the `commands` package to the evennia test command since that's where we put our test
file. In this case we could just as well just said `.` to search all of `mygame` for testing files.
If we have a lot of tests it may be useful to test only a single set at a time though. We get an
information text telling us we are using our custom settings file (instead of Evennia's default
file) and then the test runs. The test passes! Change the "FOO" string to something else in the test
to see how it looks when it fails.
### Testing commands
```{warning} This is not correct anymore.
```
This section will test the proper execution of the 'abilities' command, as described in the DELETED
tutorial to create the 'abilities' command, we will need it to test it.
Testing commands in Evennia is a bit more complex than the simple testing example we have seen.
Luckily, Evennia supplies a special test class to do just that ... we just need to inherit from it
and use it properly. This class is called 'CommandTest' and is defined in the
'evennia.commands.default.tests' package. To create a test for our 'abilities' command, we just
need to create a class that inherits from 'CommandTest' and add methods.
We could create a new test file for this but for now we just append to the `tests.py` file we
already have in `commands` from before.
```python
# bottom of mygame/commands/tests.py
from evennia.commands.default.tests import CommandTest
from commands.command import CmdAbilities
from typeclasses.characters import Character
class TestAbilities(CommandTest):
character_typeclass = Character
def test_simple(self):
self.call(CmdAbilities(), "", "STR: 5, AGI: 4, MAG: 2")
```
* Line 1-4: we do some importing. 'CommandTest' is going to be our base class for our test, so we
need it. We also import our command ('CmdAbilities' in this case). Finally we import the
'Character' typeclass. We need it, since 'CommandTest' doesn't use 'Character', but
'DefaultCharacter', which means the character calling the command won't have the abilities we have
written in the 'Character' typeclass.
* Line 6-8: that's the body of our test. Here, a single command is tested in an entire class.
Default commands are usually grouped by category in a single class. There is no rule, as long as
you know where you put your tests. Note that we set the 'character_typeclass' class attribute to
Character. As explained above, if you didn't do that, the system would create a 'DefaultCharacter'
object, not a 'Character'. You can try to remove line 4 and 8 to see what happens when running the
test.
* Line 10-11: our unique testing method. Note its name: it should begin by 'test_'. Apart from
that, the method is quite simple: it's an instance method (so it takes the 'self' argument) but no
other arguments are needed. Line 11 uses the 'call' method, which is defined in 'CommandTest'.
It's a useful method that compares a command against an expected result. It would be like comparing
two strings with 'assertEqual', but the 'call' method does more things, including testing the
command in a realistic way (calling its hooks in the right order, so you don't have to worry about
that).
Line 11 can be understood as: test the 'abilities' command (first parameter), with no argument
(second parameter), and check that the character using it receives his/her abilities (third
parameter).
Let's run our new test:
> evennia --settings settings.py test commands
[...]
Creating test database for alias 'default'...
..
----------------------------------------------------------------------
Ran 2 tests in 0.156s
OK
Destroying test database for alias 'default'...
Two tests were executed, since we have kept 'TestString' from last time. In case of failure, you
will get much more information to help you fix the bug.
```

View file

@ -73,7 +73,7 @@ method. Otherwise all text will be returned to all connected sessions.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.account.CmdOOCLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -104,7 +104,7 @@ method. Otherwise all text will be returned to all connected sessions.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.account.CmdOOCLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look while out-of-character\n\n Usage:\n look\n\n Look in the ooc state.\n '}</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n look while out-of-character\n\n Usage:\n look\n\n Look in the ooc state.\n '}</em><a class="headerlink" href="#evennia.commands.default.account.CmdOOCLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -257,7 +257,7 @@ to accounts respectively.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.admin.CmdEmit.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['pemit', 'remit']</em><a class="headerlink" href="#evennia.commands.default.admin.CmdEmit.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['remit', 'pemit']</em><a class="headerlink" href="#evennia.commands.default.admin.CmdEmit.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -288,7 +288,7 @@ to accounts respectively.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.admin.CmdEmit.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'pemit remit', 'category': 'admin', 'key': 'emit', 'no_prefix': ' pemit remit', 'tags': '', 'text': '\n admin command for emitting message to multiple objects\n\n Usage:\n emit[/switches] [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n remit [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n pemit [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n\n Switches:\n room - limit emits to rooms only (default)\n accounts - limit emits to accounts only\n contents - send to the contents of matched objects too\n\n Emits a message to the selected objects or to\n your immediate surroundings. If the object is a room,\n send to its contents. remit and pemit are just\n limited forms of emit, for sending to rooms and\n to accounts respectively.\n '}</em><a class="headerlink" href="#evennia.commands.default.admin.CmdEmit.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'remit pemit', 'category': 'admin', 'key': 'emit', 'no_prefix': ' remit pemit', 'tags': '', 'text': '\n admin command for emitting message to multiple objects\n\n Usage:\n emit[/switches] [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n remit [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n pemit [&lt;obj&gt;, &lt;obj&gt;, ... =] &lt;message&gt;\n\n Switches:\n room - limit emits to rooms only (default)\n accounts - limit emits to accounts only\n contents - send to the contents of matched objects too\n\n Emits a message to the selected objects or to\n your immediate surroundings. If the object is a room,\n send to its contents. remit and pemit are just\n limited forms of emit, for sending to rooms and\n to accounts respectively.\n '}</em><a class="headerlink" href="#evennia.commands.default.admin.CmdEmit.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -532,7 +532,7 @@ You can specify the /force switch to bypass this confirmation.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdDestroy.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;delete', '&#64;del']</em><a class="headerlink" href="#evennia.commands.default.building.CmdDestroy.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;del', '&#64;delete']</em><a class="headerlink" href="#evennia.commands.default.building.CmdDestroy.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -573,7 +573,7 @@ You can specify the /force switch to bypass this confirmation.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdDestroy.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;delete &#64;del', 'category': 'building', 'key': '&#64;destroy', 'no_prefix': 'destroy delete del', 'tags': '', 'text': '\n permanently delete objects\n\n Usage:\n destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]\n\n Switches:\n override - The destroy command will usually avoid accidentally\n destroying account objects. This switch overrides this safety.\n force - destroy without confirmation.\n Examples:\n destroy house, roof, door, 44-78\n destroy 5-10, flower, 45\n destroy/force north\n\n Destroys one or many objects. If dbrefs are used, a range to delete can be\n given, e.g. 4-10. Also the end points will be deleted. This command\n displays a confirmation before destroying, to make sure of your choice.\n You can specify the /force switch to bypass this confirmation.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdDestroy.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;del &#64;delete', 'category': 'building', 'key': '&#64;destroy', 'no_prefix': 'destroy del delete', 'tags': '', 'text': '\n permanently delete objects\n\n Usage:\n destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]\n\n Switches:\n override - The destroy command will usually avoid accidentally\n destroying account objects. This switch overrides this safety.\n force - destroy without confirmation.\n Examples:\n destroy house, roof, door, 44-78\n destroy 5-10, flower, 45\n destroy/force north\n\n Destroys one or many objects. If dbrefs are used, a range to delete can be\n given, e.g. 4-10. Also the end points will be deleted. This command\n displays a confirmation before destroying, to make sure of your choice.\n You can specify the /force switch to bypass this confirmation.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdDestroy.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -1285,7 +1285,7 @@ server settings.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdTypeclass.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;type', '&#64;swap', '&#64;typeclasses', '&#64;update', '&#64;parent']</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;type', '&#64;swap', '&#64;parent', '&#64;typeclasses', '&#64;update']</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -1316,7 +1316,7 @@ server settings.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdTypeclass.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;type &#64;swap &#64;typeclasses &#64;update &#64;parent', 'category': 'building', 'key': '&#64;typeclass', 'no_prefix': 'typeclass type swap typeclasses update parent', 'tags': '', 'text': &quot;\n set or change an object's typeclass\n\n Usage:\n typeclass[/switch] &lt;object&gt; [= typeclass.path]\n typeclass/prototype &lt;object&gt; = prototype_key\n\n typeclasses or typeclass/list/show [typeclass.path]\n swap - this is a shorthand for using /force/reset flags.\n update - this is a shorthand for using the /force/reload flag.\n\n Switch:\n show, examine - display the current typeclass of object (default) or, if\n given a typeclass path, show the docstring of that typeclass.\n update - *only* re-run at_object_creation on this object\n meaning locks or other properties set later may remain.\n reset - clean out *all* the attributes and properties on the\n object - basically making this a new clean object. This will also\n reset cmdsets!\n force - change to the typeclass also if the object\n already has a typeclass of the same name.\n list - show available typeclasses. Only typeclasses in modules actually\n imported or used from somewhere in the code will show up here\n (those typeclasses are still available if you know the path)\n prototype - clean and overwrite the object with the specified\n prototype key - effectively making a whole new object.\n\n Example:\n type button = examples.red_button.RedButton\n type/prototype button=a red button\n\n If the typeclass_path is not given, the current object's typeclass is\n assumed.\n\n View or set an object's typeclass. If setting, the creation hooks of the\n new typeclass will be run on the object. If you have clashing properties on\n the old class, use /reset. By default you are protected from changing to a\n typeclass of the same name as the one you already have - use /force to\n override this protection.\n\n The given typeclass must be identified by its location using python\n dot-notation pointing to the correct module and class. If no typeclass is\n given (or a wrong typeclass is given). Errors in the path or new typeclass\n will lead to the old typeclass being kept. The location of the typeclass\n module is searched from the default typeclass directory, as defined in the\n server settings.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;type &#64;swap &#64;parent &#64;typeclasses &#64;update', 'category': 'building', 'key': '&#64;typeclass', 'no_prefix': 'typeclass type swap parent typeclasses update', 'tags': '', 'text': &quot;\n set or change an object's typeclass\n\n Usage:\n typeclass[/switch] &lt;object&gt; [= typeclass.path]\n typeclass/prototype &lt;object&gt; = prototype_key\n\n typeclasses or typeclass/list/show [typeclass.path]\n swap - this is a shorthand for using /force/reset flags.\n update - this is a shorthand for using the /force/reload flag.\n\n Switch:\n show, examine - display the current typeclass of object (default) or, if\n given a typeclass path, show the docstring of that typeclass.\n update - *only* re-run at_object_creation on this object\n meaning locks or other properties set later may remain.\n reset - clean out *all* the attributes and properties on the\n object - basically making this a new clean object. This will also\n reset cmdsets!\n force - change to the typeclass also if the object\n already has a typeclass of the same name.\n list - show available typeclasses. Only typeclasses in modules actually\n imported or used from somewhere in the code will show up here\n (those typeclasses are still available if you know the path)\n prototype - clean and overwrite the object with the specified\n prototype key - effectively making a whole new object.\n\n Example:\n type button = examples.red_button.RedButton\n type/prototype button=a red button\n\n If the typeclass_path is not given, the current object's typeclass is\n assumed.\n\n View or set an object's typeclass. If setting, the creation hooks of the\n new typeclass will be run on the object. If you have clashing properties on\n the old class, use /reset. By default you are protected from changing to a\n typeclass of the same name as the one you already have - use /force to\n override this protection.\n\n The given typeclass must be identified by its location using python\n dot-notation pointing to the correct module and class. If no typeclass is\n given (or a wrong typeclass is given). Errors in the path or new typeclass\n will lead to the old typeclass being kept. The location of the typeclass\n module is searched from the default typeclass directory, as defined in the\n server settings.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.building.CmdTypeclass.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -1773,7 +1773,7 @@ one is given.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdFind.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;locate', '&#64;search']</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;search', '&#64;locate']</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -1804,7 +1804,7 @@ one is given.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.building.CmdFind.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;locate &#64;search', 'category': 'building', 'key': '&#64;find', 'no_prefix': 'find locate search', 'tags': '', 'text': '\n search the database for objects\n\n Usage:\n find[/switches] &lt;name or dbref or *account&gt; [= dbrefmin[-dbrefmax]]\n locate - this is a shorthand for using the /loc switch.\n\n Switches:\n room - only look for rooms (location=None)\n exit - only look for exits (destination!=None)\n char - only look for characters (BASE_CHARACTER_TYPECLASS)\n exact - only exact matches are returned.\n loc - display object location if exists and match has one result\n startswith - search for names starting with the string, rather than containing\n\n Searches the database for an object of a particular name or exact #dbref.\n Use *accountname to search for an account. The switches allows for\n limiting object matches to certain game entities. Dbrefmin and dbrefmax\n limits matches to within the given dbrefs range, or above/below if only\n one is given.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;search &#64;locate', 'category': 'building', 'key': '&#64;find', 'no_prefix': 'find search locate', 'tags': '', 'text': '\n search the database for objects\n\n Usage:\n find[/switches] &lt;name or dbref or *account&gt; [= dbrefmin[-dbrefmax]]\n locate - this is a shorthand for using the /loc switch.\n\n Switches:\n room - only look for rooms (location=None)\n exit - only look for exits (destination!=None)\n char - only look for characters (BASE_CHARACTER_TYPECLASS)\n exact - only exact matches are returned.\n loc - display object location if exists and match has one result\n startswith - search for names starting with the string, rather than containing\n\n Searches the database for an object of a particular name or exact #dbref.\n Use *accountname to search for an account. The switches allows for\n limiting object matches to certain game entities. Dbrefmin and dbrefmax\n limits matches to within the given dbrefs range, or above/below if only\n one is given.\n '}</em><a class="headerlink" href="#evennia.commands.default.building.CmdFind.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -115,7 +115,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -146,7 +146,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look &lt;obj&gt;\n look *&lt;account&gt;\n\n Observes your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look &lt;obj&gt;\n look *&lt;account&gt;\n\n Observes your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -208,7 +208,7 @@ for everyone to use, you need build privileges and the alias command.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdNick.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['nickname', 'nicks']</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['nicks', 'nickname']</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -240,7 +240,7 @@ for everyone to use, you need build privileges and the alias command.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.general.CmdNick.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'nickname nicks', 'category': 'general', 'key': 'nick', 'no_prefix': ' nickname nicks', 'tags': '', 'text': '\n define a personal alias/nick by defining a string to\n match and replace it with another on the fly\n\n Usage:\n nick[/switches] &lt;string&gt; [= [replacement_string]]\n nick[/switches] &lt;template&gt; = &lt;replacement_template&gt;\n nick/delete &lt;string&gt; or number\n nicks\n\n Switches:\n inputline - replace on the inputline (default)\n object - replace on object-lookup\n account - replace on account-lookup\n list - show all defined aliases (also &quot;nicks&quot; works)\n delete - remove nick by index in /list\n clearall - clear all nicks\n\n Examples:\n nick hi = say Hello, I\'m Sarah!\n nick/object tom = the tall man\n nick build $1 $2 = create/drop $1;$2\n nick tell $1 $2=page $1=$2\n nick tm?$1=page tallman=$1\n nick tm\\=$1=page tallman=$1\n\n A \'nick\' is a personal string replacement. Use $1, $2, ... to catch arguments.\n Put the last $-marker without an ending space to catch all remaining text. You\n can also use unix-glob matching for the left-hand side &lt;string&gt;:\n\n * - matches everything\n ? - matches 0 or 1 single characters\n [abcd] - matches these chars in any order\n [!abcd] - matches everything not among these chars\n \\= - escape literal \'=\' you want in your &lt;string&gt;\n\n Note that no objects are actually renamed or changed by this command - your nicks\n are only available to you. If you want to permanently add keywords to an object\n for everyone to use, you need build privileges and the alias command.\n\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'nicks nickname', 'category': 'general', 'key': 'nick', 'no_prefix': ' nicks nickname', 'tags': '', 'text': '\n define a personal alias/nick by defining a string to\n match and replace it with another on the fly\n\n Usage:\n nick[/switches] &lt;string&gt; [= [replacement_string]]\n nick[/switches] &lt;template&gt; = &lt;replacement_template&gt;\n nick/delete &lt;string&gt; or number\n nicks\n\n Switches:\n inputline - replace on the inputline (default)\n object - replace on object-lookup\n account - replace on account-lookup\n list - show all defined aliases (also &quot;nicks&quot; works)\n delete - remove nick by index in /list\n clearall - clear all nicks\n\n Examples:\n nick hi = say Hello, I\'m Sarah!\n nick/object tom = the tall man\n nick build $1 $2 = create/drop $1;$2\n nick tell $1 $2=page $1=$2\n nick tm?$1=page tallman=$1\n nick tm\\=$1=page tallman=$1\n\n A \'nick\' is a personal string replacement. Use $1, $2, ... to catch arguments.\n Put the last $-marker without an ending space to catch all remaining text. You\n can also use unix-glob matching for the left-hand side &lt;string&gt;:\n\n * - matches everything\n ? - matches 0 or 1 single characters\n [abcd] - matches these chars in any order\n [!abcd] - matches everything not among these chars\n \\= - escape literal \'=\' you want in your &lt;string&gt;\n\n Note that no objects are actually renamed or changed by this command - your nicks\n are only available to you. If you want to permanently add keywords to an object\n for everyone to use, you need build privileges and the alias command.\n\n '}</em><a class="headerlink" href="#evennia.commands.default.general.CmdNick.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -623,7 +623,7 @@ See <a href="#id11"><span class="problematic" id="id12">|</span></a>luhttps://ww
<dl class="py attribute">
<dt id="evennia.commands.default.system.CmdTasks.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;delays', '&#64;task']</em><a class="headerlink" href="#evennia.commands.default.system.CmdTasks.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;task', '&#64;delays']</em><a class="headerlink" href="#evennia.commands.default.system.CmdTasks.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -669,7 +669,7 @@ to all the variables defined therein.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.system.CmdTasks.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;delays &#64;task', 'category': 'system', 'key': '&#64;tasks', 'no_prefix': 'tasks delays task', 'tags': '', 'text': &quot;\n Display or terminate active tasks (delays).\n\n Usage:\n tasks[/switch] [task_id or function_name]\n\n Switches:\n pause - Pause the callback of a task.\n unpause - Process all callbacks made since pause() was called.\n do_task - Execute the task (call its callback).\n call - Call the callback of this task.\n remove - Remove a task without executing it.\n cancel - Stop a task from automatically executing.\n\n Notes:\n A task is a single use method of delaying the call of a function. Calls are created\n in code, using `evennia.utils.delay`.\n See |luhttps://www.evennia.com/docs/latest/Command-Duration.html|ltthe docs|le for help.\n\n By default, tasks that are canceled and never called are cleaned up after one minute.\n\n Examples:\n - `tasks/cancel move_callback` - Cancels all movement delays from the slow_exit contrib.\n In this example slow exits creates it's tasks with\n `utils.delay(move_delay, move_callback)`\n - `tasks/cancel 2` - Cancel task id 2.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.system.CmdTasks.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;task &#64;delays', 'category': 'system', 'key': '&#64;tasks', 'no_prefix': 'tasks task delays', 'tags': '', 'text': &quot;\n Display or terminate active tasks (delays).\n\n Usage:\n tasks[/switch] [task_id or function_name]\n\n Switches:\n pause - Pause the callback of a task.\n unpause - Process all callbacks made since pause() was called.\n do_task - Execute the task (call its callback).\n call - Call the callback of this task.\n remove - Remove a task without executing it.\n cancel - Stop a task from automatically executing.\n\n Notes:\n A task is a single use method of delaying the call of a function. Calls are created\n in code, using `evennia.utils.delay`.\n See |luhttps://www.evennia.com/docs/latest/Command-Duration.html|ltthe docs|le for help.\n\n By default, tasks that are canceled and never called are cleaned up after one minute.\n\n Examples:\n - `tasks/cancel move_callback` - Cancels all movement delays from the slow_exit contrib.\n In this example slow exits creates it's tasks with\n `utils.delay(move_delay, move_callback)`\n - `tasks/cancel 2` - Cancel task id 2.\n\n &quot;}</em><a class="headerlink" href="#evennia.commands.default.system.CmdTasks.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -50,136 +50,10 @@ main test suite started with</p>
<blockquote>
<div><p>&gt; python game/manage.py test.</p>
</div></blockquote>
<dl class="py class">
<dt id="evennia.commands.default.tests.CommandTestMixin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">CommandTestMixin</code><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTestMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTestMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Mixin to add to a test in order to provide the <strong>.call</strong> helper for
testing the execution and returns of a command.</p>
<p>Tests a Command by running it and comparing what messages it sends with
expected values. This tests without actually spinning up the cmdhandler
for every test, which is more controlled.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">commands.echo</span> <span class="kn">import</span> <span class="n">CmdEcho</span>
<span class="k">class</span> <span class="nc">MyCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_echo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">MyCommand</span><span class="p">(),</span> <span class="s2">&quot;hello world!&quot;</span><span class="p">,</span>
<span class="s2">&quot;You hear your echo: &#39;Hello world!&#39;&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt id="evennia.commands.default.tests.CommandTestMixin.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdobj</span></em>, <em class="sig-param"><span class="n">input_args</span></em>, <em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdset</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">noansi</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">caller</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">receiver</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdstring</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">raw_string</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTestMixin.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTestMixin.call" title="Permalink to this definition"></a></dt>
<dd><p>Test a command by assigning all the needed properties to a cmdobj and
running the sequence. The resulting <strong>.msg</strong> calls will be mocked and
the text= calls to them compared to a expected output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cmdobj</strong> (<a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><em>Command</em></a>) The command object to use.</p></li>
<li><p><strong>input_args</strong> (<em>str</em>) This should be the full input the Command should
see, such as look here. This will become <strong>.args</strong> for the Command
instance to parse.</p></li>
<li><p><strong>msg</strong> (<em>str</em><em> or </em><em>dict</em><em>, </em><em>optional</em>) This is the expected return value(s)
returned through <strong>caller.msg(text=…)</strong> calls in the command. If a string, the
receiver is controlled with the <strong>receiver</strong> kwarg (defaults to <strong>caller</strong>).
If this is a <strong>dict</strong>, it is a mapping
<strong>{receiver1: “expected1”, receiver2: “expected2”,…}</strong> and <strong>receiver</strong> is
ignored. The message(s) are compared with the actual messages returned
to the receiver(s) as the Command runs. Each check uses <strong>.startswith</strong>,
so you can choose to only include the first part of the
returned message if thats enough to verify a correct result. EvMenu
decorations (like borders) are stripped and should not be included. This
should also not include color tags unless <strong>noansi=False</strong>.
If the command returns texts in multiple separate <strong>.msg</strong>-
calls to a receiver, separate these with <strong>|</strong> if <strong>noansi=True</strong>
(default) and <strong>||</strong> if <strong>noansi=False</strong>. If no <strong>msg</strong> is given (<strong>None</strong>),
then no automatic comparison will be done.</p></li>
<li><p><strong>cmdset</strong> (<em>str</em><em>, </em><em>optional</em>) If given, make <strong>.cmdset</strong> available on the Command
instance as it runs. While <strong>.cmdset</strong> is normally available on the
Command instance by default, this is usually only used by
commands that explicitly operates/displays cmdsets, like
<strong>examine</strong>.</p></li>
<li><p><strong>noansi</strong> (<em>str</em><em>, </em><em>optional</em>) By default the color tags of the <strong>msg</strong> is
ignored, this makes them significant. If unset, <strong>msg</strong> must contain
the same color tags as the actual return message.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) By default <strong>self.char1</strong> is used as the
command-caller (the <strong>.caller</strong> property on the Command). This allows to
execute with another caller, most commonly an Account.</p></li>
<li><p><strong>receiver</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) This is the object to receive the
return messages we want to test. By default this is the same as <strong>caller</strong>
(which in turn defaults to is <strong>self.char1</strong>). Note that if <strong>msg</strong> is
a <strong>dict</strong>, this is ignored since the receiver is already specified there.</p></li>
<li><p><strong>cmdstring</strong> (<em>str</em><em>, </em><em>optional</em>) Normally this is the Commands <strong>key</strong>.
This allows for tweaking the <strong>.cmdname</strong> property of the
Command**. This isb used for commands with multiple aliases,
where the command explicitly checs which alias was used to
determine its functionality.</p></li>
<li><p><strong>obj</strong> (<em>str</em><em>, </em><em>optional</em>) This sets the <strong>.obj</strong> property of the Command - the
object on which the Command sits. By default this is the same as <strong>caller</strong>.
This can be used for testing on-object Command interactions.</p></li>
<li><p><strong>inputs</strong> (<em>list</em><em>, </em><em>optional</em>) A list of strings to pass to functions that pause to
take input from the user (normally using <strong>&#64;interactive</strong> and
<strong>ret = yield(question)</strong> or <strong>evmenu.get_input</strong>). Each element of the
list will be passed into the command as if the user wrote that at the prompt.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em><em>, </em><em>optional</em>) Normally the <strong>.raw_string</strong> property is set as
a combination of your <strong>key/cmdname</strong> and <strong>input_args</strong>. This allows
direct control of what this is, for example for testing edge cases
or malformed inputs.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>str or dict</em> </p>
<dl class="simple">
<dt>The message sent to <strong>receiver</strong>, or a dict of</dt><dd><p><strong>{receiver: “msg”, …}</strong> if multiple are given. This is usually
only used with <strong>msg=None</strong> to do the validation externally.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>AssertionError</strong> If the returns of <strong>.msg</strong> calls (tested with <strong>.startswith</strong>) does not
match <strong>expected_input</strong>.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>As part of the tests, all methods of the Command will be called in
the proper order:</p>
<ul class="simple">
<li><p>cmdobj.at_pre_cmd()</p></li>
<li><p>cmdobj.parse()</p></li>
<li><p>cmdobj.func()</p></li>
<li><p>cmdobj.at_post_cmd()</p></li>
</ul>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.EvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">EvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#EvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.EvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest" title="evennia.utils.test_resources.BaseEvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.commands.default.tests.CommandTestMixin" title="evennia.commands.default.tests.CommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.CommandTestMixin</span></code></a></p>
<p>Commands only using the default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.CommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">CommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#CommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.CommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.commands.default.tests.CommandTestMixin" title="evennia.commands.default.tests.CommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.CommandTestMixin</span></code></a></p>
<p>Parent class to inherit from - makes tests use your own
classes and settings in mygame.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestGeneral">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestGeneral</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestGeneral"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestGeneral" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestGeneral.test_look">
<code class="sig-name descname">test_look</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestGeneral.test_look"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestGeneral.test_look" title="Permalink to this definition"></a></dt>
@ -240,7 +114,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestHelp">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestHelp</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestHelp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestHelp" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py attribute">
<dt id="evennia.commands.default.tests.TestHelp.maxDiff">
<code class="sig-name descname">maxDiff</code><em class="property"> = None</em><a class="headerlink" href="#evennia.commands.default.tests.TestHelp.maxDiff" title="Permalink to this definition"></a></dt>
@ -350,7 +224,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestSystem">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestSystem</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystem"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystem" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestSystem.test_py">
<code class="sig-name descname">test_py</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystem.test_py"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystem.test_py" title="Permalink to this definition"></a></dt>
@ -386,7 +260,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestCmdTasks">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestCmdTasks</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCmdTasks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCmdTasks" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestCmdTasks.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCmdTasks.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCmdTasks.setUp" title="Permalink to this definition"></a></dt>
@ -481,7 +355,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestAdmin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestAdmin</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAdmin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAdmin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestAdmin.test_emit">
<code class="sig-name descname">test_emit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAdmin.test_emit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAdmin.test_emit" title="Permalink to this definition"></a></dt>
@ -512,7 +386,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestAccount">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestAccount</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAccount"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAccount" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestAccount.test_ooc_look">
<code class="sig-name descname">test_ooc_look</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestAccount.test_ooc_look"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestAccount.test_ooc_look" title="Permalink to this definition"></a></dt>
@ -588,7 +462,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestBuilding">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestBuilding</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBuilding"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBuilding" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestBuilding.test_create">
<code class="sig-name descname">test_create</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBuilding.test_create"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBuilding.test_create" title="Permalink to this definition"></a></dt>
@ -736,7 +610,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestCommsChannel">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestCommsChannel</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestCommsChannel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestCommsChannel" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the central <strong>channel</strong> command.</p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestCommsChannel.setUp">
@ -847,7 +721,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestComms">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestComms</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestComms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestComms" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestComms.test_page">
<code class="sig-name descname">test_page</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestComms.test_page"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestComms.test_page" title="Permalink to this definition"></a></dt>
@ -858,7 +732,7 @@ classes and settings in mygame.</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestBatchProcess">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestBatchProcess</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestBatchProcess"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestBatchProcess" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the batch processor.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.tests.TestBatchProcess.red_button">
@ -977,7 +851,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestInterruptCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestInterruptCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestInterruptCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestInterruptCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command">
<code class="sig-name descname">test_interrupt_command</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestInterruptCommand.test_interrupt_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestInterruptCommand.test_interrupt_command" title="Permalink to this definition"></a></dt>
@ -988,7 +862,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestUnconnectedCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestUnconnectedCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestUnconnectedCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestUnconnectedCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestUnconnectedCommand.test_info_command">
<code class="sig-name descname">test_info_command</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestUnconnectedCommand.test_info_command"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestUnconnectedCommand.test_info_command" title="Permalink to this definition"></a></dt>
@ -999,7 +873,7 @@ set in self.parse())</p>
<dl class="py class">
<dt id="evennia.commands.default.tests.TestSystemCommands">
<em class="property">class </em><code class="sig-prename descclassname">evennia.commands.default.tests.</code><code class="sig-name descname">TestSystemCommands</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystemCommands"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystemCommands" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.commands.default.tests.TestSystemCommands.test_simple_defaults">
<code class="sig-name descname">test_simple_defaults</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/commands/default/tests.html#TestSystemCommands.test_simple_defaults"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.commands.default.tests.TestSystemCommands.test_simple_defaults" title="Permalink to this definition"></a></dt>

View file

@ -62,7 +62,7 @@ connect “account name” “pass word”</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['con', 'co', 'conn']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['conn', 'con', 'co']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -97,7 +97,7 @@ there is no object yet before the account has logged in)</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'con co conn', 'category': 'general', 'key': 'connect', 'no_prefix': ' con co conn', 'tags': '', 'text': '\n connect to the game\n\n Usage (at login screen):\n connect accountname password\n connect &quot;account name&quot; &quot;pass word&quot;\n\n Use the create command to first create an account before logging in.\n\n If you have spaces in your name, enclose it in double quotes.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'conn con co', 'category': 'general', 'key': 'connect', 'no_prefix': ' conn con co', 'tags': '', 'text': '\n connect to the game\n\n Usage (at login screen):\n connect accountname password\n connect &quot;account name&quot; &quot;pass word&quot;\n\n Use the create command to first create an account before logging in.\n\n If you have spaces in your name, enclose it in double quotes.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -275,7 +275,7 @@ for simplicity. It shows a pane of info.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedHelp.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['h', '?']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedHelp.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['?', 'h']</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedHelp.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -301,7 +301,7 @@ for simplicity. It shows a pane of info.</p>
<dl class="py attribute">
<dt id="evennia.commands.default.unloggedin.CmdUnconnectedHelp.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'h ?', 'category': 'general', 'key': 'help', 'no_prefix': ' h ?', 'tags': '', 'text': '\n get help when in unconnected-in state\n\n Usage:\n help\n\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '? h', 'category': 'general', 'key': 'help', 'no_prefix': ' ? h', 'tags': '', 'text': '\n get help when in unconnected-in state\n\n Usage:\n help\n\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}</em><a class="headerlink" href="#evennia.commands.default.unloggedin.CmdUnconnectedHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -68,7 +68,7 @@ Use <strong>add_choice</strong> and its variants to create menu choices.</p>
<dl class="py class">
<dt id="evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.building_menu.tests.</code><code class="sig-name descname">TestBuildingMenu</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/building_menu/tests.html#TestBuildingMenu"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/building_menu/tests.html#TestBuildingMenu.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.building_menu.tests.TestBuildingMenu.setUp" title="Permalink to this definition"></a></dt>

View file

@ -78,7 +78,7 @@ the module given by settings.CONNECTION_SCREEN_MODULE.</p>
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['con', 'co', 'conn']</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['conn', 'con', 'co']</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -108,7 +108,7 @@ there is no object yet before the account has logged in)</p>
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'con co conn', 'category': 'general', 'key': 'connect', 'no_prefix': ' con co conn', 'tags': '', 'text': '\n Connect to the game.\n\n Usage (at login screen):\n connect &lt;email&gt; &lt;password&gt;\n\n Use the create command to first create an account before logging in.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'conn con co', 'category': 'general', 'key': 'connect', 'no_prefix': ' conn con co', 'tags': '', 'text': '\n Connect to the game.\n\n Usage (at login screen):\n connect &lt;email&gt; &lt;password&gt;\n\n Use the create command to first create an account before logging in.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedConnect.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -274,7 +274,7 @@ for simplicity. It shows a pane of info.</p>
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['h', '?']</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['?', 'h']</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -300,7 +300,7 @@ for simplicity. It shows a pane of info.</p>
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'h ?', 'category': 'general', 'key': 'help', 'no_prefix': ' h ?', 'tags': '', 'text': '\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '? h', 'category': 'general', 'key': 'help', 'no_prefix': ' ? h', 'tags': '', 'text': '\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.email_login.email_login.CmdUnconnectedHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.base_systems.email_login.tests.TestEmailLogin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.email_login.tests.</code><code class="sig-name descname">TestEmailLogin</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/email_login/tests.html#TestEmailLogin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.email_login.tests.TestEmailLogin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.email_login.tests.TestEmailLogin.test_connect">
<code class="sig-name descname">test_connect</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/email_login/tests.html#TestEmailLogin.test_connect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.email_login.tests.TestEmailLogin.test_connect" title="Permalink to this definition"></a></dt>

View file

@ -55,7 +55,7 @@
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.ingame_python.commands.CmdCallback.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;callback', '&#64;calls', '&#64;callbacks']</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.commands.CmdCallback.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['&#64;callbacks', '&#64;callback', '&#64;calls']</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.commands.CmdCallback.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -136,7 +136,7 @@ on user permission.</p>
<dl class="py attribute">
<dt id="evennia.contrib.base_systems.ingame_python.commands.CmdCallback.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;callback &#64;calls &#64;callbacks', 'category': 'building', 'key': '&#64;call', 'no_prefix': 'call callback calls callbacks', 'tags': '', 'text': '\n Command to edit callbacks.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.commands.CmdCallback.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '&#64;callbacks &#64;callback &#64;calls', 'category': 'building', 'key': '&#64;call', 'no_prefix': 'call callbacks callback calls', 'tags': '', 'text': '\n Command to edit callbacks.\n '}</em><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.commands.CmdCallback.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -113,7 +113,7 @@
<dl class="py class">
<dt id="evennia.contrib.base_systems.ingame_python.tests.TestCmdCallback">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.tests.</code><code class="sig-name descname">TestCmdCallback</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/tests.html#TestCmdCallback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.tests.TestCmdCallback" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the &#64;callback command.</p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.ingame_python.tests.TestCmdCallback.setUp">
@ -162,7 +162,7 @@
<dl class="py class">
<dt id="evennia.contrib.base_systems.ingame_python.tests.TestDefaultCallbacks">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.ingame_python.tests.</code><code class="sig-name descname">TestDefaultCallbacks</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/ingame_python/tests.html#TestDefaultCallbacks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.ingame_python.tests.TestDefaultCallbacks" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the default callbacks.</p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.ingame_python.tests.TestDefaultCallbacks.setUp">

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.base_systems.mux_comms_cmds.tests.TestLegacyMuxComms">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.mux_comms_cmds.tests.</code><code class="sig-name descname">TestLegacyMuxComms</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/mux_comms_cmds/tests.html#TestLegacyMuxComms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.mux_comms_cmds.tests.TestLegacyMuxComms" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the legacy comms contrib.</p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.mux_comms_cmds.tests.TestLegacyMuxComms.setUp">

View file

@ -90,7 +90,7 @@
<dl class="py class">
<dt id="evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.base_systems.unixcommand.tests.</code><code class="sig-name descname">TestUnixCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/unixcommand/tests.html#TestUnixCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand.test_success">
<code class="sig-name descname">test_success</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/base_systems/unixcommand/tests.html#TestUnixCommand.test_success"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.base_systems.unixcommand.tests.TestUnixCommand.test_success" title="Permalink to this definition"></a></dt>

View file

@ -150,7 +150,7 @@ the operation will be general or on the room.</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['quit', 'q', 'abort', 'chicken out']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['quit', 'abort', 'q', 'chicken out']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
@ -174,7 +174,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'quit q abort chicken out', 'category': 'evscaperoom', 'key': 'give up', 'no_prefix': ' quit q abort chicken out', 'tags': '', 'text': '\n Give up\n\n Usage:\n give up\n\n Abandons your attempts at escaping and of ever winning the pie-eating contest.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'quit abort q chicken out', 'category': 'evscaperoom', 'key': 'give up', 'no_prefix': ' quit abort q chicken out', 'tags': '', 'text': '\n Give up\n\n Usage:\n give up\n\n Abandons your attempts at escaping and of ever winning the pie-eating contest.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGiveUp.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -195,7 +195,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -229,7 +229,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'evscaperoom', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n Look at the room, an object or the currently focused object\n\n Usage:\n look [obj]\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'evscaperoom', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n Look at the room, an object or the currently focused object\n\n Usage:\n look [obj]\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -310,7 +310,7 @@ shout</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['whisper', ';', 'shout']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = [';', 'shout', 'whisper']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -339,7 +339,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'whisper ; shout', 'category': 'general', 'key': 'say', 'no_prefix': ' whisper ; shout', 'tags': '', 'text': '\n Perform an communication action.\n\n Usage:\n say &lt;text&gt;\n whisper\n shout\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '; shout whisper', 'category': 'general', 'key': 'say', 'no_prefix': ' ; shout whisper', 'tags': '', 'text': '\n Perform an communication action.\n\n Usage:\n say &lt;text&gt;\n whisper\n shout\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdSpeak.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -429,7 +429,7 @@ looks and what actions is available.</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['e', 'examine', 'unfocus', 'ex']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['e', 'unfocus', 'ex', 'examine']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -458,7 +458,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'e examine unfocus ex', 'category': 'evscaperoom', 'key': 'focus', 'no_prefix': ' e examine unfocus ex', 'tags': '', 'text': '\n Focus your attention on a target.\n\n Usage:\n focus &lt;obj&gt;\n\n Once focusing on an object, use look to get more information about how it\n looks and what actions is available.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'e unfocus ex examine', 'category': 'evscaperoom', 'key': 'focus', 'no_prefix': ' e unfocus ex examine', 'tags': '', 'text': '\n Focus your attention on a target.\n\n Usage:\n focus &lt;obj&gt;\n\n Once focusing on an object, use look to get more information about how it\n looks and what actions is available.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdFocus.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -520,7 +520,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdGet.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['inv', 'give', 'inventory', 'i']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGet.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['i', 'inv', 'give', 'inventory']</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGet.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
@ -544,7 +544,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.full_systems.evscaperoom.commands.CmdGet.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'inv give inventory i', 'category': 'evscaperoom', 'key': 'get', 'no_prefix': ' inv give inventory i', 'tags': '', 'text': '\n Use focus / examine instead.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGet.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'i inv give inventory', 'category': 'evscaperoom', 'key': 'get', 'no_prefix': ' i inv give inventory', 'tags': '', 'text': '\n Use focus / examine instead.\n\n '}</em><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.commands.CmdGet.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.full_systems.evscaperoom.tests.</code><code class="sig-name descname">TestEvscaperoomCommands</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/full_systems/evscaperoom/tests.html#TestEvscaperoomCommands"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/full_systems/evscaperoom/tests.html#TestEvscaperoomCommands.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.full_systems.evscaperoom.tests.TestEvscaperoomCommands.setUp" title="Permalink to this definition"></a></dt>

View file

@ -684,7 +684,7 @@ try to influence the other part in the deal.</p>
<dl class="py attribute">
<dt id="evennia.contrib.game_systems.barter.barter.CmdStatus.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['deal', 'offers']</em><a class="headerlink" href="#evennia.contrib.game_systems.barter.barter.CmdStatus.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['offers', 'deal']</em><a class="headerlink" href="#evennia.contrib.game_systems.barter.barter.CmdStatus.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -710,7 +710,7 @@ try to influence the other part in the deal.</p>
<dl class="py attribute">
<dt id="evennia.contrib.game_systems.barter.barter.CmdStatus.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'deal offers', 'category': 'trading', 'key': 'status', 'no_prefix': ' deal offers', 'tags': '', 'text': &quot;\n show a list of the current deal\n\n Usage:\n status\n deal\n offers\n\n Shows the currently suggested offers on each sides of the deal. To\n accept the current deal, use the 'accept' command. Use 'offer' to\n change your deal. You might also want to use 'say', 'emote' etc to\n try to influence the other part in the deal.\n &quot;}</em><a class="headerlink" href="#evennia.contrib.game_systems.barter.barter.CmdStatus.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'offers deal', 'category': 'trading', 'key': 'status', 'no_prefix': ' offers deal', 'tags': '', 'text': &quot;\n show a list of the current deal\n\n Usage:\n status\n deal\n offers\n\n Shows the currently suggested offers on each sides of the deal. To\n accept the current deal, use the 'accept' command. Use 'offer' to\n change your deal. You might also want to use 'say', 'emote' etc to\n try to influence the other part in the deal.\n &quot;}</em><a class="headerlink" href="#evennia.contrib.game_systems.barter.barter.CmdStatus.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.barter.tests.TestBarter">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.barter.tests.</code><code class="sig-name descname">TestBarter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/barter/tests.html#TestBarter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.barter.tests.TestBarter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.barter.tests.TestBarter.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/barter/tests.html#TestBarter.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.barter.tests.TestBarter.setUp" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.clothing.tests.TestClothingCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.clothing.tests.</code><code class="sig-name descname">TestClothingCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/clothing/tests.html#TestClothingCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.clothing.tests.TestClothingCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.clothing.tests.TestClothingCmd.test_clothingcommands">
<code class="sig-name descname">test_clothingcommands</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/clothing/tests.html#TestClothingCmd.test_clothingcommands"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.clothing.tests.TestClothingCmd.test_clothingcommands" title="Permalink to this definition"></a></dt>

View file

@ -228,7 +228,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.crafting.tests.TestCraftCommand">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.crafting.tests.</code><code class="sig-name descname">TestCraftCommand</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/crafting/tests.html#TestCraftCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.crafting.tests.TestCraftCommand" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<p>Test the crafting command</p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.crafting.tests.TestCraftCommand.setUp">

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.gendersub.tests.TestGenderSub">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.gendersub.tests.</code><code class="sig-name descname">TestGenderSub</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/gendersub/tests.html#TestGenderSub"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.gendersub.tests.TestGenderSub" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.gendersub.tests.TestGenderSub.test_setgender">
<code class="sig-name descname">test_setgender</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/gendersub/tests.html#TestGenderSub.test_setgender"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.gendersub.tests.TestGenderSub.test_setgender" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.mail.tests.TestMail">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.mail.tests.</code><code class="sig-name descname">TestMail</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/mail/tests.html#TestMail"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.mail.tests.TestMail" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.mail.tests.TestMail.test_mail">
<code class="sig-name descname">test_mail</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/mail/tests.html#TestMail.test_mail"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.mail.tests.TestMail.test_mail" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.multidescer.tests.TestMultidescer">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.multidescer.tests.</code><code class="sig-name descname">TestMultidescer</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/multidescer/tests.html#TestMultidescer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.multidescer.tests.TestMultidescer" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.multidescer.tests.TestMultidescer.test_cmdmultidesc">
<code class="sig-name descname">test_cmdmultidesc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/multidescer/tests.html#TestMultidescer.test_cmdmultidesc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.multidescer.tests.TestMultidescer.test_cmdmultidesc" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.puzzles.tests.TestPuzzles">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.puzzles.tests.</code><code class="sig-name descname">TestPuzzles</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/puzzles/tests.html#TestPuzzles"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.puzzles.tests.TestPuzzles" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.puzzles.tests.TestPuzzles.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/puzzles/tests.html#TestPuzzles.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.puzzles.tests.TestPuzzles.setUp" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.turnbattle.tests.</code><code class="sig-name descname">TestTurnBattleBasicCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleBasicCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd.test_turnbattlecmd">
<code class="sig-name descname">test_turnbattlecmd</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleBasicCmd.test_turnbattlecmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleBasicCmd.test_turnbattlecmd" title="Permalink to this definition"></a></dt>
@ -57,7 +57,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.turnbattle.tests.</code><code class="sig-name descname">TestTurnBattleEquipCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleEquipCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleEquipCmd.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleEquipCmd.setUp" title="Permalink to this definition"></a></dt>
@ -74,7 +74,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.turnbattle.tests.</code><code class="sig-name descname">TestTurnBattleRangeCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleRangeCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd.test_turnbattlerangecmd">
<code class="sig-name descname">test_turnbattlerangecmd</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleRangeCmd.test_turnbattlerangecmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleRangeCmd.test_turnbattlerangecmd" title="Permalink to this definition"></a></dt>
@ -85,7 +85,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.turnbattle.tests.</code><code class="sig-name descname">TestTurnBattleItemsCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleItemsCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleItemsCmd.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleItemsCmd.setUp" title="Permalink to this definition"></a></dt>
@ -102,7 +102,7 @@
<dl class="py class">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.game_systems.turnbattle.tests.</code><code class="sig-name descname">TestTurnBattleMagicCmd</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleMagicCmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd.test_turnbattlemagiccmd">
<code class="sig-name descname">test_turnbattlemagiccmd</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/game_systems/turnbattle/tests.html#TestTurnBattleMagicCmd.test_turnbattlemagiccmd"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.game_systems.turnbattle.tests.TestTurnBattleMagicCmd.test_turnbattlemagiccmd" title="Permalink to this definition"></a></dt>

View file

@ -279,7 +279,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -299,7 +299,7 @@ look <a href="#id1"><span class="problematic" id="id2">*</span></a>&lt;account&g
<dl class="py attribute">
<dt id="evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look\n\n Usage:\n look\n look &lt;obj&gt;\n look &lt;room detail&gt;\n look *&lt;account&gt;\n\n Observes your location, details at your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n look\n\n Usage:\n look\n look &lt;obj&gt;\n look &lt;room detail&gt;\n look *&lt;account&gt;\n\n Observes your location, details at your location or objects in your vicinity.\n '}</em><a class="headerlink" href="#evennia.contrib.grid.extended_room.extended_room.CmdExtendedRoomLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -59,7 +59,7 @@
<dl class="py class">
<dt id="evennia.contrib.grid.extended_room.tests.TestExtendedRoom">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.grid.extended_room.tests.</code><code class="sig-name descname">TestExtendedRoom</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/grid/extended_room/tests.html#TestExtendedRoom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.grid.extended_room.tests.TestExtendedRoom" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py attribute">
<dt id="evennia.contrib.grid.extended_room.tests.TestExtendedRoom.room_typeclass">
<code class="sig-name descname">room_typeclass</code><a class="headerlink" href="#evennia.contrib.grid.extended_room.tests.TestExtendedRoom.room_typeclass" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.grid.simpledoor.tests.TestSimpleDoor">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.grid.simpledoor.tests.</code><code class="sig-name descname">TestSimpleDoor</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/grid/simpledoor/tests.html#TestSimpleDoor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.grid.simpledoor.tests.TestSimpleDoor" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.grid.simpledoor.tests.TestSimpleDoor.test_cmdopen">
<code class="sig-name descname">test_cmdopen</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/grid/simpledoor/tests.html#TestSimpleDoor.test_cmdopen"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.grid.simpledoor.tests.TestSimpleDoor.test_cmdopen" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.grid.slow_exit.tests.TestSlowExit">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.grid.slow_exit.tests.</code><code class="sig-name descname">TestSlowExit</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/grid/slow_exit/tests.html#TestSlowExit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.grid.slow_exit.tests.TestSlowExit" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.grid.slow_exit.tests.TestSlowExit.test_exit">
<code class="sig-name descname">test_exit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/grid/slow_exit/tests.html#TestSlowExit.test_exit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.grid.slow_exit.tests.TestSlowExit.test_exit" title="Permalink to this definition"></a></dt>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.rpg.dice.tests.TestDice">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.rpg.dice.tests.</code><code class="sig-name descname">TestDice</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/tests.html#TestDice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.tests.TestDice" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.rpg.dice.tests.TestDice.test_roll_dice">
<code class="sig-name descname">test_roll_dice</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">mocked_randint</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/dice/tests.html#TestDice.test_roll_dice"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.dice.tests.TestDice.test_roll_dice" title="Permalink to this definition"></a></dt>

View file

@ -147,7 +147,7 @@
<dl class="py class">
<dt id="evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.rpg.rpsystem.tests.</code><code class="sig-name descname">TestRPSystemCommands</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/rpsystem/tests.html#TestRPSystemCommands"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands.setUp">
<code class="sig-name descname">setUp</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/rpg/rpsystem/tests.html#TestRPSystemCommands.setUp"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.rpg.rpsystem.tests.TestRPSystemCommands.setUp" title="Permalink to this definition"></a></dt>

View file

@ -84,7 +84,7 @@ such as when closing the lid and un-blinding a character.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['press', 'press button', 'push']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['push', 'press button', 'press']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -113,7 +113,7 @@ check if the lid is open or closed.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'press press button push', 'category': 'general', 'key': 'push button', 'no_prefix': ' press press button push', 'tags': '', 'text': '\n Push the red button (lid closed)\n\n Usage:\n push button\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'push press button press', 'category': 'general', 'key': 'push button', 'no_prefix': ' push press button press', 'tags': '', 'text': '\n Push the red button (lid closed)\n\n Usage:\n push button\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidClosed.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -310,7 +310,7 @@ be mutually exclusive.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['press', 'press button', 'push']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['push', 'press button', 'press']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -339,7 +339,7 @@ set in self.parse())</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'press press button push', 'category': 'general', 'key': 'push button', 'no_prefix': ' press press button push', 'tags': '', 'text': '\n Push the red button\n\n Usage:\n push button\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'push press button press', 'category': 'general', 'key': 'push button', 'no_prefix': ' push press button press', 'tags': '', 'text': '\n Push the red button\n\n Usage:\n push button\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdPushLidOpen.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -437,7 +437,7 @@ be mutually exclusive.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'listen', 'examine', 'feel', 'get', 'ex']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['feel', 'l', 'examine', 'listen', 'ex', 'get']</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -463,7 +463,7 @@ be mutually exclusive.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l listen examine feel get ex', 'category': 'general', 'key': 'look', 'no_prefix': ' l listen examine feel get ex', 'tags': '', 'text': &quot;\n Looking around in darkness\n\n Usage:\n look &lt;obj&gt;\n\n ... not that there's much to see in the dark.\n\n &quot;}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'feel l examine listen ex get', 'category': 'general', 'key': 'look', 'no_prefix': ' feel l examine listen ex get', 'tags': '', 'text': &quot;\n Looking around in darkness\n\n Usage:\n look &lt;obj&gt;\n\n ... not that there's much to see in the dark.\n\n &quot;}</em><a class="headerlink" href="#evennia.contrib.tutorials.red_button.red_button.CmdBlindLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -46,7 +46,7 @@
<dl class="py class">
<dt id="evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.tutorials.talking_npc.tests.</code><code class="sig-name descname">TestTalkingNPC</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/talking_npc/tests.html#TestTalkingNPC"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC.test_talkingnpc">
<code class="sig-name descname">test_talkingnpc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/talking_npc/tests.html#TestTalkingNPC.test_talkingnpc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.talking_npc.tests.TestTalkingNPC.test_talkingnpc" title="Permalink to this definition"></a></dt>

View file

@ -495,7 +495,7 @@ shift green root up/down</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['move', 'pull', 'push', 'shiftroot']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['move', 'shiftroot', 'push', 'pull']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -531,7 +531,7 @@ yellow/green - horizontal roots</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'move pull push shiftroot', 'category': 'tutorialworld', 'key': 'shift', 'no_prefix': ' move pull push shiftroot', 'tags': '', 'text': '\n Shifts roots around.\n\n Usage:\n shift blue root left/right\n shift red root left/right\n shift yellow root up/down\n shift green root up/down\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'move shiftroot push pull', 'category': 'tutorialworld', 'key': 'shift', 'no_prefix': ' move shiftroot push pull', 'tags': '', 'text': '\n Shifts roots around.\n\n Usage:\n shift blue root left/right\n shift red root left/right\n shift yellow root up/down\n shift green root up/down\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdShiftRoot.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -718,7 +718,7 @@ parry - forgoes your attack but will make you harder to hit on next</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['bash', 'pierce', 'thrust', 'chop', 'fight', 'parry', 'defend', 'stab', 'slash', 'kill', 'hit']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['bash', 'defend', 'fight', 'slash', 'parry', 'hit', 'thrust', 'kill', 'chop', 'pierce', 'stab']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -744,7 +744,7 @@ parry - forgoes your attack but will make you harder to hit on next</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'bash pierce thrust chop fight parry defend stab slash kill hit', 'category': 'tutorialworld', 'key': 'attack', 'no_prefix': ' bash pierce thrust chop fight parry defend stab slash kill hit', 'tags': '', 'text': '\n Attack the enemy. Commands:\n\n stab &lt;enemy&gt;\n slash &lt;enemy&gt;\n parry\n\n stab - (thrust) makes a lot of damage but is harder to hit with.\n slash - is easier to land, but does not make as much damage.\n parry - forgoes your attack but will make you harder to hit on next\n enemy attack.\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'bash defend fight slash parry hit thrust kill chop pierce stab', 'category': 'tutorialworld', 'key': 'attack', 'no_prefix': ' bash defend fight slash parry hit thrust kill chop pierce stab', 'tags': '', 'text': '\n Attack the enemy. Commands:\n\n stab &lt;enemy&gt;\n slash &lt;enemy&gt;\n parry\n\n stab - (thrust) makes a lot of damage but is harder to hit with.\n slash - is easier to land, but does not make as much damage.\n parry - forgoes your attack but will make you harder to hit on next\n enemy attack.\n\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.objects.CmdAttack.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -187,7 +187,7 @@ code except for adding in the details.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['ls', 'l']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['l', 'ls']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -202,7 +202,7 @@ code except for adding in the details.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'ls l', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n looks at the room and on details\n\n Usage:\n look &lt;obj&gt;\n look &lt;room detail&gt;\n look *&lt;account&gt;\n\n Observes your location, details at your location or objects\n in your vicinity.\n\n Tutorial: This is a child of the default Look command, that also\n allows us to look at &quot;details&quot; in the room. These details are\n things to examine and offers some extra description without\n actually having to be actual database objects. It uses the\n return_detail() hook on TutorialRooms for this.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'l ls', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' l ls', 'tags': '', 'text': '\n looks at the room and on details\n\n Usage:\n look &lt;obj&gt;\n look &lt;room detail&gt;\n look *&lt;account&gt;\n\n Observes your location, details at your location or objects\n in your vicinity.\n\n Tutorial: This is a child of the default Look command, that also\n allows us to look at &quot;details&quot; in the room. These details are\n things to examine and offers some extra description without\n actually having to be actual database objects. It uses the\n return_detail() hook on TutorialRooms for this.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdTutorialLook.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -716,7 +716,7 @@ if they fall off the bridge.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['h', '?']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['?', 'h']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -742,7 +742,7 @@ if they fall off the bridge.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'h ?', 'category': 'tutorial world', 'key': 'help', 'no_prefix': ' h ?', 'tags': '', 'text': '\n Overwritten help command while on the bridge.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': '? h', 'category': 'tutorial world', 'key': 'help', 'no_prefix': ' ? h', 'tags': '', 'text': '\n Overwritten help command while on the bridge.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdBridgeHelp.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
@ -868,7 +868,7 @@ to find something.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['search', 'l', 'feel around', 'feel', 'fiddle']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['fiddle', 'feel', 'l', 'search', 'feel around']</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -896,7 +896,7 @@ random chance of eventually finding a light source.</p>
<dl class="py attribute">
<dt id="evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'search l feel around feel fiddle', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' search l feel around feel fiddle', 'tags': '', 'text': '\n Look around in darkness\n\n Usage:\n look\n\n Look around in the darkness, trying\n to find something.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'fiddle feel l search feel around', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' fiddle feel l search feel around', 'tags': '', 'text': '\n Look around in darkness\n\n Usage:\n look\n\n Look around in the darkness, trying\n to find something.\n '}</em><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.rooms.CmdLookDark.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -57,7 +57,7 @@
<dl class="py class">
<dt id="evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.tutorials.tutorial_world.tests.</code><code class="sig-name descname">TestTutorialWorldObjects</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/tutorial_world/tests.html#TestTutorialWorldObjects"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.trial._asynctest.TestCase</span></code>, <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">twisted.trial._asynctest.TestCase</span></code>, <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects.test_tutorialobj">
<code class="sig-name descname">test_tutorialobj</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/tutorial_world/tests.html#TestTutorialWorldObjects.test_tutorialobj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldObjects.test_tutorialobj" title="Permalink to this definition"></a></dt>
@ -103,7 +103,7 @@
<dl class="py class">
<dt id="evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms">
<em class="property">class </em><code class="sig-prename descclassname">evennia.contrib.tutorials.tutorial_world.tests.</code><code class="sig-name descname">TestTutorialWorldRooms</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/tutorial_world/tests.html#TestTutorialWorldRooms"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest" title="evennia.commands.default.tests.EvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.commands.default.tests.EvenniaCommandTest</span></code></a></p>
<dd><p>Bases: <a class="reference internal" href="evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest" title="evennia.utils.test_resources.BaseEvenniaCommandTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaCommandTest</span></code></a></p>
<dl class="py method">
<dt id="evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms.test_cmdtutorial">
<code class="sig-name descname">test_cmdtutorial</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/contrib/tutorials/tutorial_world/tests.html#TestTutorialWorldRooms.test_cmdtutorial"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.contrib.tutorials.tutorial_world.tests.TestTutorialWorldRooms.test_cmdtutorial" title="Permalink to this definition"></a></dt>

View file

@ -277,7 +277,7 @@ indentation.</p>
<dl class="py attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = [':DD', ':x', ':S', ':h', ':echo', ':fi', ':w', ':wq', ':p', ':dw', ':I', ':', ':u', ':&gt;', ':s', ':j', ':f', ':UU', ':::', ':i', ':q', ':A', ':dd', ':&lt;', ':y', ':!', ':=', '::', ':q!', ':uu', ':r', ':fd']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = [':dd', ':i', ':p', ':DD', ':y', '::', ':UU', ':A', ':fd', ':x', ':S', ':q!', ':j', ':I', ':h', ':w', ':', ':&lt;', ':=', ':dw', ':q', ':r', ':::', ':f', ':&gt;', ':uu', ':wq', ':!', ':fi', ':echo', ':s', ':u']</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -305,7 +305,7 @@ efficient presentation.</p>
<dl class="py attribute">
<dt id="evennia.utils.eveditor.CmdEditorGroup.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': ':DD :x :S :h :echo :fi :w :wq :p :dw :I : :u :&gt; :s :j :f :UU ::: :i :q :A :dd :&lt; :y :! := :: :q! :uu :r :fd', 'category': 'general', 'key': ':editor_command_group', 'no_prefix': ' :DD :x :S :h :echo :fi :w :wq :p :dw :I : :u :&gt; :s :j :f :UU ::: :i :q :A :dd :&lt; :y :! := :: :q! :uu :r :fd', 'tags': '', 'text': '\n Commands for the editor\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': ':dd :i :p :DD :y :: :UU :A :fd :x :S :q! :j :I :h :w : :&lt; := :dw :q :r ::: :f :&gt; :uu :wq :! :fi :echo :s :u', 'category': 'general', 'key': ':editor_command_group', 'no_prefix': ' :dd :i :p :DD :y :: :UU :A :fd :x :S :q! :j :I :h :w : :&lt; := :dw :q :r ::: :f :&gt; :uu :wq :! :fi :echo :s :u', 'tags': '', 'text': '\n Commands for the editor\n '}</em><a class="headerlink" href="#evennia.utils.eveditor.CmdEditorGroup.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -947,7 +947,7 @@ single question.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmenu.CmdYesNoQuestion.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['n', 'no', 'a', '__nomatch_command', 'abort', 'yes', 'y']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['yes', 'no', 'n', 'a', 'abort', 'y', '__nomatch_command']</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -973,7 +973,7 @@ single question.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'n no a __nomatch_command abort yes y', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' n no a __nomatch_command abort yes y', 'tags': '', 'text': '\n Handle a prompt for yes or no. Press [return] for the default choice.\n\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'yes no n a abort y __nomatch_command', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' yes no n a abort y __nomatch_command', 'tags': '', 'text': '\n Handle a prompt for yes or no. Press [return] for the default choice.\n\n '}</em><a class="headerlink" href="#evennia.utils.evmenu.CmdYesNoQuestion.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -78,7 +78,7 @@ the <strong>caller.msg()</strong> construct every time the page is updated.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmore.CmdMore.aliases">
<code class="sig-name descname">aliases</code><em class="property"> = ['end', 'q', 'previous', 'e', 'n', 'a', 'top', 'abort', 'next', 'quit', 'p', 't']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.aliases" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">aliases</code><em class="property"> = ['q', 'end', 'p', 'previous', 'n', 'top', 'e', 'a', 'next', 't', 'quit', 'abort']</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.aliases" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py attribute">
@ -104,7 +104,7 @@ the <strong>caller.msg()</strong> construct every time the page is updated.</p>
<dl class="py attribute">
<dt id="evennia.utils.evmore.CmdMore.search_index_entry">
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'end q previous e n a top abort next quit p t', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' end q previous e n a top abort next quit p t', 'tags': '', 'text': '\n Manipulate the text paging. Catch no-input with aliases.\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.search_index_entry" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">search_index_entry</code><em class="property"> = {'aliases': 'q end p previous n top e a next t quit abort', 'category': 'general', 'key': '__noinput_command', 'no_prefix': ' q end p previous n top e a next t quit abort', 'tags': '', 'text': '\n Manipulate the text paging. Catch no-input with aliases.\n '}</em><a class="headerlink" href="#evennia.utils.evmore.CmdMore.search_index_entry" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>

View file

@ -43,6 +43,29 @@
<section id="module-evennia.utils.test_resources">
<span id="evennia-utils-test-resources"></span><h1>evennia.utils.test_resources<a class="headerlink" href="#module-evennia.utils.test_resources" title="Permalink to this headline"></a></h1>
<p>Various helper resources for writing unittests.</p>
<p>Classes for testing Evennia core:</p>
<ul class="simple">
<li><p><strong>BaseEvenniaTestCase</strong> - no default objects, only enforced default settings</p></li>
<li><p><strong>BaseEvenniaTest</strong> - all default objects, enforced default settings</p></li>
<li><p><strong>BaseEvenniaCommandTest</strong> - for testing Commands, enforced default settings</p></li>
</ul>
<p>Classes for testing game folder content:</p>
<ul class="simple">
<li><dl class="simple">
<dt><strong>EvenniaTestCase</strong> - no default objects, using gamedir settings (identical to</dt><dd><p>standard Python TestCase)</p>
</dd>
</dl>
</li>
<li><p><strong>EvenniaTest</strong> - all default objects, using gamedir settings</p></li>
<li><p><strong>EvenniaCommandTest</strong> - for testing game folder commands, using gamedir settings</p></li>
</ul>
<p>Other:</p>
<ul class="simple">
<li><p><strong>EvenniaTestMixin</strong> - A class mixin for creating the test environment objects, for
making custom tests.</p></li>
<li><p><strong>EvenniaCommandMixin</strong> - A class mixin that adds support for command testing with the .call()
helper. Used by the command-test classes, but can be used for making a customt test class.</p></li>
</ul>
<dl class="py function">
<dt id="evennia.utils.test_resources.mockdelay">
<code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">mockdelay</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">timedelay</span></em>, <em class="sig-param"><span class="n">callback</span></em>, <em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#mockdelay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.mockdelay" title="Permalink to this definition"></a></dt>
@ -172,12 +195,129 @@ loaded once).</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaCommandTestMixin">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaCommandTestMixin</code><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTestMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Mixin to add to a test in order to provide the <strong>.call</strong> helper for
testing the execution and returns of a command.</p>
<p>Tests a Command by running it and comparing what messages it sends with
expected values. This tests without actually spinning up the cmdhandler
for every test, which is more controlled.</p>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">commands.echo</span> <span class="kn">import</span> <span class="n">CmdEcho</span>
<span class="k">class</span> <span class="nc">MyCommandTest</span><span class="p">(</span><span class="n">EvenniaTest</span><span class="p">,</span> <span class="n">CommandTestMixin</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">test_echo</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Test that the echo command really returns</span>
<span class="sd"> what you pass into it.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="n">MyCommand</span><span class="p">(),</span> <span class="s2">&quot;hello world!&quot;</span><span class="p">,</span>
<span class="s2">&quot;You hear your echo: &#39;Hello world!&#39;&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="py method">
<dt id="evennia.utils.test_resources.EvenniaCommandTestMixin.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">cmdobj</span></em>, <em class="sig-param"><span class="n">input_args</span></em>, <em class="sig-param"><span class="n">msg</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdset</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">noansi</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">caller</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">receiver</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">cmdstring</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">obj</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">inputs</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">raw_string</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTestMixin.call"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTestMixin.call" title="Permalink to this definition"></a></dt>
<dd><p>Test a command by assigning all the needed properties to a cmdobj and
running the sequence. The resulting <strong>.msg</strong> calls will be mocked and
the text= calls to them compared to a expected output.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cmdobj</strong> (<a class="reference internal" href="evennia.commands.command.html#evennia.commands.command.Command" title="evennia.commands.command.Command"><em>Command</em></a>) The command object to use.</p></li>
<li><p><strong>input_args</strong> (<em>str</em>) This should be the full input the Command should
see, such as look here. This will become <strong>.args</strong> for the Command
instance to parse.</p></li>
<li><p><strong>msg</strong> (<em>str</em><em> or </em><em>dict</em><em>, </em><em>optional</em>) This is the expected return value(s)
returned through <strong>caller.msg(text=…)</strong> calls in the command. If a string, the
receiver is controlled with the <strong>receiver</strong> kwarg (defaults to <strong>caller</strong>).
If this is a <strong>dict</strong>, it is a mapping
<strong>{receiver1: “expected1”, receiver2: “expected2”,…}</strong> and <strong>receiver</strong> is
ignored. The message(s) are compared with the actual messages returned
to the receiver(s) as the Command runs. Each check uses <strong>.startswith</strong>,
so you can choose to only include the first part of the
returned message if thats enough to verify a correct result. EvMenu
decorations (like borders) are stripped and should not be included. This
should also not include color tags unless <strong>noansi=False</strong>.
If the command returns texts in multiple separate <strong>.msg</strong>-
calls to a receiver, separate these with <strong>|</strong> if <strong>noansi=True</strong>
(default) and <strong>||</strong> if <strong>noansi=False</strong>. If no <strong>msg</strong> is given (<strong>None</strong>),
then no automatic comparison will be done.</p></li>
<li><p><strong>cmdset</strong> (<em>str</em><em>, </em><em>optional</em>) If given, make <strong>.cmdset</strong> available on the Command
instance as it runs. While <strong>.cmdset</strong> is normally available on the
Command instance by default, this is usually only used by
commands that explicitly operates/displays cmdsets, like
<strong>examine</strong>.</p></li>
<li><p><strong>noansi</strong> (<em>str</em><em>, </em><em>optional</em>) By default the color tags of the <strong>msg</strong> is
ignored, this makes them significant. If unset, <strong>msg</strong> must contain
the same color tags as the actual return message.</p></li>
<li><p><strong>caller</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) By default <strong>self.char1</strong> is used as the
command-caller (the <strong>.caller</strong> property on the Command). This allows to
execute with another caller, most commonly an Account.</p></li>
<li><p><strong>receiver</strong> (<em>Object</em><em> or </em><em>Account</em><em>, </em><em>optional</em>) This is the object to receive the
return messages we want to test. By default this is the same as <strong>caller</strong>
(which in turn defaults to is <strong>self.char1</strong>). Note that if <strong>msg</strong> is
a <strong>dict</strong>, this is ignored since the receiver is already specified there.</p></li>
<li><p><strong>cmdstring</strong> (<em>str</em><em>, </em><em>optional</em>) Normally this is the Commands <strong>key</strong>.
This allows for tweaking the <strong>.cmdname</strong> property of the
Command**. This isb used for commands with multiple aliases,
where the command explicitly checs which alias was used to
determine its functionality.</p></li>
<li><p><strong>obj</strong> (<em>str</em><em>, </em><em>optional</em>) This sets the <strong>.obj</strong> property of the Command - the
object on which the Command sits. By default this is the same as <strong>caller</strong>.
This can be used for testing on-object Command interactions.</p></li>
<li><p><strong>inputs</strong> (<em>list</em><em>, </em><em>optional</em>) A list of strings to pass to functions that pause to
take input from the user (normally using <strong>&#64;interactive</strong> and
<strong>ret = yield(question)</strong> or <strong>evmenu.get_input</strong>). Each element of the
list will be passed into the command as if the user wrote that at the prompt.</p></li>
<li><p><strong>raw_string</strong> (<em>str</em><em>, </em><em>optional</em>) Normally the <strong>.raw_string</strong> property is set as
a combination of your <strong>key/cmdname</strong> and <strong>input_args</strong>. This allows
direct control of what this is, for example for testing edge cases
or malformed inputs.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>str or dict</em> </p>
<dl class="simple">
<dt>The message sent to <strong>receiver</strong>, or a dict of</dt><dd><p><strong>{receiver: “msg”, …}</strong> if multiple are given. This is usually
only used with <strong>msg=None</strong> to do the validation externally.</p>
</dd>
</dl>
</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>AssertionError</strong> If the returns of <strong>.msg</strong> calls (tested with <strong>.startswith</strong>) does not
match <strong>expected_input</strong>.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>As part of the tests, all methods of the Command will be called in
the proper order:</p>
<ul class="simple">
<li><p>cmdobj.at_pre_cmd()</p></li>
<li><p>cmdobj.parse()</p></li>
<li><p>cmdobj.func()</p></li>
<li><p>cmdobj.at_post_cmd()</p></li>
</ul>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.BaseEvenniaTestCase">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">BaseEvenniaTestCase</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#BaseEvenniaTestCase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.BaseEvenniaTestCase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.test.testcases.TestCase</span></code></p>
<p>Base test (with no default objects) but with
enforced default settings.</p>
<p>Base test (with no default objects) but with enforced default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaTestCase">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaTestCase</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaTestCase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaTestCase" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">django.test.testcases.TestCase</span></code></p>
<p>For use with gamedir settings; Just like the normal test case, only for naming consistency.</p>
</dd></dl>
<dl class="py class">
@ -226,6 +366,21 @@ and settings from your game folder.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.BaseEvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">BaseEvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#BaseEvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.BaseEvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.test_resources.BaseEvenniaTest" title="evennia.utils.test_resources.BaseEvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.BaseEvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="evennia.utils.test_resources.EvenniaCommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaCommandTestMixin</span></code></a></p>
<p>Commands only using the default settings.</p>
</dd></dl>
<dl class="py class">
<dt id="evennia.utils.test_resources.EvenniaCommandTest">
<em class="property">class </em><code class="sig-prename descclassname">evennia.utils.test_resources.</code><code class="sig-name descname">EvenniaCommandTest</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/utils/test_resources.html#EvenniaCommandTest"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.utils.test_resources.EvenniaCommandTest" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.utils.test_resources.EvenniaTest" title="evennia.utils.test_resources.EvenniaTest"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaTest</span></code></a>, <a class="reference internal" href="#evennia.utils.test_resources.EvenniaCommandTestMixin" title="evennia.utils.test_resources.EvenniaCommandTestMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.utils.test_resources.EvenniaCommandTestMixin</span></code></a></p>
<p>Parent class to inherit from - makes tests use your own
classes and settings in mygame.</p>
</dd></dl>
</section>

View file

@ -2466,6 +2466,8 @@
<li><a href="api/evennia.contrib.full_systems.evscaperoom.objects.html#evennia.contrib.full_systems.evscaperoom.objects.BaseConsumable.DoesNotExist">BaseConsumable.DoesNotExist</a>
</li>
<li><a href="api/evennia.contrib.full_systems.evscaperoom.objects.html#evennia.contrib.full_systems.evscaperoom.objects.BaseConsumable.MultipleObjectsReturned">BaseConsumable.MultipleObjectsReturned</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaCommandTest">BaseEvenniaCommandTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.BaseEvenniaTest">BaseEvenniaTest (class in evennia.utils.test_resources)</a>
</li>
@ -2677,14 +2679,14 @@
</li>
<li><a href="api/evennia.contrib.grid.xyzgrid.xymap.html#evennia.contrib.grid.xyzgrid.xymap.XYMap.calculate_path_matrix">calculate_path_matrix() (evennia.contrib.grid.xyzgrid.xymap.XYMap method)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin.call">call() (evennia.commands.default.tests.CommandTestMixin method)</a>
<li><a href="api/evennia.contrib.base_systems.ingame_python.callbackhandler.html#evennia.contrib.base_systems.ingame_python.callbackhandler.CallbackHandler.call">call() (evennia.contrib.base_systems.ingame_python.callbackhandler.CallbackHandler method)</a>
<ul>
<li><a href="api/evennia.contrib.base_systems.ingame_python.callbackhandler.html#evennia.contrib.base_systems.ingame_python.callbackhandler.CallbackHandler.call">(evennia.contrib.base_systems.ingame_python.callbackhandler.CallbackHandler method)</a>
</li>
<li><a href="api/evennia.contrib.base_systems.ingame_python.scripts.html#evennia.contrib.base_systems.ingame_python.scripts.EventHandler.call">(evennia.contrib.base_systems.ingame_python.scripts.EventHandler method)</a>
</li>
<li><a href="api/evennia.scripts.taskhandler.html#evennia.scripts.taskhandler.TaskHandlerTask.call">(evennia.scripts.taskhandler.TaskHandlerTask method)</a>, <a href="api/evennia.scripts.taskhandler.html#id3">[1]</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin.call">(evennia.utils.test_resources.EvenniaCommandTestMixin method)</a>
</li>
</ul></li>
<li><a href="api/evennia.contrib.base_systems.ingame_python.eventfuncs.html#evennia.contrib.base_systems.ingame_python.eventfuncs.call_event">call_event() (in module evennia.contrib.base_systems.ingame_python.eventfuncs)</a>
@ -3352,11 +3354,11 @@
<li><a href="api/evennia.contrib.grid.xyzgrid.commands.html#evennia.contrib.grid.xyzgrid.commands.CmdMap">CmdMap (class in evennia.contrib.grid.xyzgrid.commands)</a>
</li>
<li><a href="api/evennia.contrib.rpg.rpsystem.rpsystem.html#evennia.contrib.rpg.rpsystem.rpsystem.CmdMask">CmdMask (class in evennia.contrib.rpg.rpsystem.rpsystem)</a>
</li>
<li><a href="api/evennia.contrib.tutorials.tutorial_world.mob.html#evennia.contrib.tutorials.tutorial_world.mob.CmdMobOnOff">CmdMobOnOff (class in evennia.contrib.tutorials.tutorial_world.mob)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="api/evennia.contrib.tutorials.tutorial_world.mob.html#evennia.contrib.tutorials.tutorial_world.mob.CmdMobOnOff">CmdMobOnOff (class in evennia.contrib.tutorials.tutorial_world.mob)</a>
</li>
<li><a href="api/evennia.utils.evmore.html#evennia.utils.evmore.CmdMore">CmdMore (class in evennia.utils.evmore)</a>
</li>
<li><a href="api/evennia.utils.evmore.html#evennia.utils.evmore.CmdMoreExit">CmdMoreExit (class in evennia.utils.evmore)</a>
@ -3755,10 +3757,6 @@
<li><a href="api/evennia.server.portal.amp.html#evennia.server.portal.amp.MsgStatus.commandName">(evennia.server.portal.amp.MsgStatus attribute)</a>
</li>
</ul></li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTest">CommandTest (class in evennia.commands.default.tests)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.CommandTestMixin">CommandTestMixin (class in evennia.commands.default.tests)</a>
</li>
<li><a href="api/evennia.comms.managers.html#evennia.comms.managers.CommError">CommError</a>
</li>
<li><a href="api/evennia.contrib.base_systems.ingame_python.scripts.html#evennia.contrib.base_systems.ingame_python.scripts.complete_task">complete_task() (in module evennia.contrib.base_systems.ingame_python.scripts)</a>
@ -7379,7 +7377,9 @@
</li>
<li><a href="api/evennia.web.api.root.html#evennia.web.api.root.EvenniaAPIRoot">EvenniaAPIRoot (class in evennia.web.api.root)</a>
</li>
<li><a href="api/evennia.commands.default.tests.html#evennia.commands.default.tests.EvenniaCommandTest">EvenniaCommandTest (class in evennia.commands.default.tests)</a>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTest">EvenniaCommandTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaCommandTestMixin">EvenniaCommandTestMixin (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.web.website.views.mixins.html#evennia.web.website.views.mixins.EvenniaCreateView">EvenniaCreateView (class in evennia.web.website.views.mixins)</a>
</li>
@ -7404,6 +7404,8 @@
<li><a href="api/evennia.server.webserver.html#evennia.server.webserver.EvenniaReverseProxyResource">EvenniaReverseProxyResource (class in evennia.server.webserver)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTest">EvenniaTest (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestCase">EvenniaTestCase (class in evennia.utils.test_resources)</a>
</li>
<li><a href="api/evennia.utils.test_resources.html#evennia.utils.test_resources.EvenniaTestMixin">EvenniaTestMixin (class in evennia.utils.test_resources)</a>
</li>

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -126,21 +126,15 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="Coding/Unit-Testing.html">Unit Testing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#running-the-evennia-test-suite">Running the Evennia test suite</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#running-tests-with-custom-settings-file">Running tests with custom settings file</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#writing-new-tests">Writing new tests</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#using-the-evenniatest-class">Using the EvenniaTest class</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#testing-in-game-commands">Testing in-game Commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#unit-testing-contribs-with-custom-models">Unit testing contribs with custom models</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#a-note-on-adding-new-tests">A note on adding new tests</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#a-note-on-making-the-test-runner-faster">A note on making the test runner faster</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#testing-for-game-development-mini-tutorial">Testing for Game development (mini-tutorial)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#basic-testing-using-evennia">Basic testing using Evennia</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#a-simple-example">A simple example</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#testing-commands">Testing commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#running-tests-for-your-game-dir">Running tests for your game dir</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#writing-new-tests">Writing new tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#using-the-evennia-testing-classes">Using the Evennia testing classes</a><ul>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#classes-for-testing-your-game-dir">Classes for testing your game dir</a></li>
<li class="toctree-l3"><a class="reference internal" href="Coding/Unit-Testing.html#classes-for-testing-evennia-core">Classes for testing Evennia core</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#unit-testing-contribs-with-custom-models">Unit testing contribs with custom models</a></li>
<li class="toctree-l2"><a class="reference internal" href="Coding/Unit-Testing.html#a-note-on-making-the-test-runner-faster">A note on making the test runner faster</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="Coding/Updating-Your-Game.html">Updating Your Game</a><ul>