evennia.commands.default.tests

This is part of the Evennia unittest framework, for testing the stability and integrity of the codebase during updates. This module test the default command set. It is instantiated by the evennia/objects/tests.py module, which in turn is run by as part of the main test suite started with

> python game/manage.py test.

class evennia.commands.default.tests.TestGeneral(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_look()[源代码]
test_look_no_location()[源代码]
test_look_nonexisting()[源代码]
test_home()[源代码]
test_go_home()[源代码]
test_no_home()[源代码]
test_inventory()[源代码]
test_pose()[源代码]
test_nick()[源代码]
test_nick_list()[源代码]
test_get_and_drop()[源代码]
test_give()[源代码]
test_numbered_target_command()[源代码]
test_mux_command()[源代码]
test_say()[源代码]
test_whisper()[源代码]
test_access()[源代码]
class evennia.commands.default.tests.TestHelp(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

maxDiff = None
setUp()[源代码]

Sets up testing environment

tearDown()[源代码]

Hook method for deconstructing the test fixture after testing it.

test_help()[源代码]
test_set_help()[源代码]
test_subtopic_fetch = None
test_subtopic_fetch_00_test(**kw)

Check retrieval of subtopics [with helparg=’test’, expected=’Help for testnnMain help text… test/something else test/more’].

test_subtopic_fetch_01_test_creating_extra_stuff(**kw)

Check retrieval of subtopics [with helparg=’test/creating extra stuff’, expected=’Help for test/creating extra st…ating extra stuff/subsubtopicn’].

test_subtopic_fetch_02_test_creating(**kw)

Check retrieval of subtopics [with helparg=’test/creating’, expected=’Help for test/creating extra st…ating extra stuff/subsubtopicn’].

test_subtopic_fetch_03_test_extra(**kw)

Check retrieval of subtopics [with helparg=’test/extra’, expected=’Help for test/creating extra st…ating extra stuff/subsubtopicn’].

test_subtopic_fetch_04_test_extra_subsubtopic(**kw)

Check retrieval of subtopics [with helparg=’test/extra/subsubtopic’, expected=’Help for test/creating extra st…bsubtopicnnA subsubtopic text’].

test_subtopic_fetch_05_test_creating_extra_subsub(**kw)

Check retrieval of subtopics [with helparg=’test/creating extra/subsub’, expected=’Help for test/creating extra st…bsubtopicnnA subsubtopic text’].

test_subtopic_fetch_06_test_Something_else(**kw)

Check retrieval of subtopics [with helparg=’test/Something else’, expected=’Help for test/something elsennSomething else’].

test_subtopic_fetch_07_test_More(**kw)

Check retrieval of subtopics [with helparg=’test/More’, expected=’Help for test/morennAnother t…opics:n test/more/second-more’].

test_subtopic_fetch_08_test_More_Second_more(**kw)

Check retrieval of subtopics [with helparg=’test/More/Second-more’, expected=’Help for test/more/second-more...est/more/second-more/third more’].

test_subtopic_fetch_09_test_More_more(**kw)

Check retrieval of subtopics [with helparg=’test/More/-more’, expected=’Help for test/more/second-more...est/more/second-more/third more’].

test_subtopic_fetch_10_test_more_second_more_again(**kw)

Check retrieval of subtopics [with helparg=’test/more/second/more again’, expected=’Help for test/more/second-more/more againnnEven more text.n’].

test_subtopic_fetch_11_test_more_second_third(**kw)

Check retrieval of subtopics [with helparg=’test/more/second/third’, expected=’Help for test/more/second-more/third morennThird more textn’].

class evennia.commands.default.tests.TestSystem(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_py()[源代码]
test_scripts()[源代码]
test_objects()[源代码]
test_about()[源代码]
test_server_load()[源代码]
evennia.commands.default.tests.func_test_cmd_tasks()[源代码]
class evennia.commands.default.tests.TestCmdTasks(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

setUp()[源代码]

Sets up testing environment

tearDown()[源代码]

Hook method for deconstructing the test fixture after testing it.

test_no_tasks()[源代码]
test_active_task()[源代码]
test_persistent_task()[源代码]
test_pause_unpause()[源代码]
test_do_task()[源代码]
test_remove()[源代码]
test_call()[源代码]
test_cancel()[源代码]
test_func_name_manipulation()[源代码]
test_wrong_func_name()[源代码]
test_no_input()[源代码]
test_responce_of_yes()[源代码]
test_task_complete_waiting_input()[源代码]

Test for task completing while waiting for input.

test_new_task_waiting_input()[源代码]

Test task completing than a new task with the same ID being made while waitinf for input.

test_misformed_command()[源代码]
class evennia.commands.default.tests.TestAdmin(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_emit()[源代码]
test_perm()[源代码]
test_wall()[源代码]
test_ban()[源代码]
test_force()[源代码]
class evennia.commands.default.tests.TestAccount(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

Test different account-specific modes

test_ooc_look = None
test_ooc()[源代码]
test_ic()[源代码]
test_ic__other_object()[源代码]
test_ic__nonaccess()[源代码]
test_password()[源代码]
test_option()[源代码]
test_who()[源代码]
test_quit()[源代码]
test_sessions()[源代码]
test_color_test()[源代码]
test_char_create()[源代码]
test_char_delete()[源代码]
test_quell()[源代码]
test_ooc_look_00(**kw)
test_ooc_look_01(**kw)
test_ooc_look_02(**kw)
test_ooc_look_03(**kw)
test_ooc_look_04(**kw)
test_ooc_look_05(**kw)
test_ooc_look_06(**kw)
test_ooc_look_07(**kw)
test_ooc_look_08(**kw)
test_ooc_look_09(**kw)
test_ooc_look_10(**kw)
test_ooc_look_11(**kw)
test_ooc_look_12(**kw)
test_ooc_look_13(**kw)
test_ooc_look_14(**kw)
test_ooc_look_15(**kw)
class evennia.commands.default.tests.TestBuilding(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_create()[源代码]
test_create_characters()[源代码]

verify creating DefaultCharacter-descendant objects works, for NPCs

test_examine()[源代码]
test_set_obj_alias()[源代码]
test_copy()[源代码]
test_attribute_commands()[源代码]
test_nested_attribute_commands()[源代码]
test_split_nested_attr()[源代码]
test_do_nested_lookup()[源代码]
test_name()[源代码]
test_name_clears_plural()[源代码]
test_desc()[源代码]
test_empty_desc()[源代码]

empty desc sets desc as ‘’

test_desc_default_to_room()[源代码]

no rhs changes room’s desc

test_destroy()[源代码]
test_destroy_sequence()[源代码]
test_dig()[源代码]
test_tunnel()[源代码]
test_tunnel_exit_typeclass()[源代码]
test_exit_commands()[源代码]
test_set_home()[源代码]
test_list_cmdsets()[源代码]
test_typeclass()[源代码]
test_lock()[源代码]
test_find()[源代码]
test_script()[源代码]
test_script_multi_delete()[源代码]
test_teleport()[源代码]
test_tag()[源代码]
test_spawn()[源代码]
class evennia.commands.default.tests.TestCommsChannel(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

Test the central channel command.

setUp()[源代码]

Sets up testing environment

tearDown()[源代码]

Hook method for deconstructing the test fixture after testing it.

test_channel__noarg()[源代码]
test_channel__msg()[源代码]
test_channel__list()[源代码]
test_channel__all()[源代码]
test_channel__history()[源代码]
test_channel__sub()[源代码]
test_channel__unsub()[源代码]
test_channel__alias__unalias()[源代码]

Add and then remove a channel alias

test_channel__mute()[源代码]
test_channel__unmute()[源代码]
test_channel__create()[源代码]
test_channel__destroy()[源代码]
test_channel__desc()[源代码]
test_channel__lock()[源代码]
test_channel__unlock()[源代码]
test_channel__boot()[源代码]
test_channel__ban__unban()[源代码]

Test first ban and then unban

test_channel__who()[源代码]
class evennia.commands.default.tests.TestComms(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_page()[源代码]
class evennia.commands.default.tests.TestDiscord(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

setUp()[源代码]

Sets up testing environment

tearDown()[源代码]

Hook method for deconstructing the test fixture after testing it.

test_discord__switches = None
test_discord__linking()[源代码]
test_discord__list()[源代码]
test_discord__switches_0_(**kw)
test_discord__switches_1__list(**kw)
test_discord__switches_2__guild(**kw)
test_discord__switches_3__channel(**kw)
class evennia.commands.default.tests.TestBatchProcess(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

Test the batch processor.

red_button = <module 'evennia.contrib.tutorials.red_button.red_button' from '/home/bluedeep/work/evennia/evennia/contrib/tutorials/red_button/red_button.py'>
test_batch_commands(mock_tutorials, mock_repeat)[源代码]
class evennia.commands.default.tests.CmdInterrupt(**kwargs)[源代码]

基类:evennia.commands.command.Command

(you may see this if a child command had no help text defined)

Usage:

command [args]

This is the base command class. Inherit from this to create new commands.

The cmdhandler makes the following variables available to the command methods (so you can always assume them to be there):

self.caller - the game object calling the command self.cmdstring - the command name used to trigger this command (allows

you to know which alias was used, for example)

self.args - everything supplied to the command following the cmdstring

(this is usually what is parsed in self.parse())

self.cmdset - the merged cmdset from which this command was matched (useful only

seldomly, notably for help-type commands, to create dynamic help entries and lists)

self.cmdset_source - the specific cmdset this command was matched from. self.obj - the object on which this command is defined. If a default command,

this is usually the same as caller.

self.raw_string - the full raw string input, including the command name,

any args and no parsing.

The following class properties can/should be defined on your child class:

key - identifier for command (e.g. “look”) aliases - (optional) list of aliases (e.g. [“l”, “loo”]) locks - lock string (default is “cmd:all()”) help_category - how to organize this help entry in help system

(default is “General”)

auto_help - defaults to True. Allows for turning off auto-help generation arg_regex - (optional) raw string regex defining how the argument part of

the command should look in order to match for this command (e.g. must it be a space between cmdname and arg?)

auto_help_display_key - (optional) if given, this replaces the string shown

in the auto-help listing. This is particularly useful for system-commands whose actual key is not really meaningful.

(Note that if auto_help is on, this initial string is also used by the system to create the help entry for the command, so it’s a good idea to format it similar to this one). This behavior can be changed by overriding the method ‘get_help’ of a command: by default, this method returns cmd.__doc__ (that is, this very docstring, or the docstring of your command). You can, however, extend or replace this without disabling auto_help.

key = 'interrupt'
parse()[源代码]

Once the cmdhandler has identified this as the command we want, this function is run. If many of your commands have a similar syntax (for example ‘cmd arg1 = arg2’) you should simply define this once and just let other commands of the same form inherit from this. See the docstring of this module for which object properties are available to use (notably self.args).

func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'interrupt', 'no_prefix': ' ', 'tags': '', 'text': '\n ## Base command\n\n (you may see this if a child command had no help text defined)\n\n Usage:\n command [args]\n\n This is the base command class. Inherit from this\n to create new commands.\n\n The cmdhandler makes the following variables available to the\n command methods (so you can always assume them to be there):\n\n self.caller - the game object calling the command\n self.cmdstring - the command name used to trigger this command (allows\n you to know which alias was used, for example)\n self.args - everything supplied to the command following the cmdstring\n (this is usually what is parsed in self.parse())\n self.cmdset - the merged cmdset from which this command was matched (useful only\n seldomly, notably for help-type commands, to create dynamic\n help entries and lists)\n self.cmdset_source - the specific cmdset this command was matched from.\n self.obj - the object on which this command is defined. If a default command,\n this is usually the same as caller.\n self.raw_string - the full raw string input, including the command name,\n any args and no parsing.\n\n The following class properties can/should be defined on your child class:\n\n key - identifier for command (e.g. "look")\n aliases - (optional) list of aliases (e.g. ["l", "loo"])\n locks - lock string (default is "cmd:all()")\n help_category - how to organize this help entry in help system\n (default is "General")\n auto_help - defaults to True. Allows for turning off auto-help generation\n arg_regex - (optional) raw string regex defining how the argument part of\n the command should look in order to match for this command\n (e.g. must it be a space between cmdname and arg?)\n auto_help_display_key - (optional) if given, this replaces the string shown\n in the auto-help listing. This is particularly useful for system-commands\n whose actual key is not really meaningful.\n\n (Note that if auto_help is on, this initial string is also used by the\n system to create the help entry for the command, so it\'s a good idea to\n format it similar to this one). This behavior can be changed by\n overriding the method \'get_help\' of a command: by default, this\n method returns cmd.__doc__ (that is, this very docstring, or\n the docstring of your command). You can, however, extend or\n replace this without disabling auto_help.\n '}
class evennia.commands.default.tests.TestInterruptCommand(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_interrupt_command()[源代码]
class evennia.commands.default.tests.TestUnconnectedCommand(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_info_command()[源代码]
test_disabled_registration()[源代码]
class evennia.commands.default.tests.TestSystemCommands(methodName='runTest')[源代码]

基类:evennia.utils.test_resources.BaseEvenniaCommandTest

test_simple_defaults()[源代码]
test_multimatch()[源代码]