evennia.utils.tests package

Submodules

evennia.utils.tests.test_ansi module

Test of the ANSI parsing and ANSIStrings.

class evennia.utils.tests.test_ansi.TestANSIString(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Verifies that ANSIString’s string-API works as intended.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_clean()[source]
test_format()[source]
test_length()[source]
test_raw()[source]
test_split_with_mixed_strings()[source]

This tests the solution of a bug

evennia.utils.tests.test_batchprocessors module

Tests for batchprocessors

class evennia.utils.tests.test_batchprocessors.TestBatchCodeProcessor(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_execs_codeblock(mocked_exec)[source]
test_execs_codeblock_raises(mocked_exec)[source]
test_execs_codeblock_with_extra_environ(mocked_exec)[source]
test_parses_INSERT(mocked_read)[source]
test_parses_INSERT_raises_IOError(mocked_read)[source]
test_parses_codeblocks(mocked_read)[source]
test_parses_header_and_two_codeblock(mocked_read)[source]
test_parses_one_codeblock(mocked_read)[source]
class evennia.utils.tests.test_batchprocessors.TestBatchCommandProcessor(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_parses_2_commands(mocked_read)[source]
test_parses_INSERT(mocked_read)[source]
test_parses_INSERT_raises_IOError(mocked_read)[source]
class evennia.utils.tests.test_batchprocessors.TestBatchprocessorErrors(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_read_batchfile_raises_IOError(_)[source]
test_read_batchfile_raises_UnicodeDecodeError(*_)[source]

evennia.utils.tests.test_create_functions module

Tests of create functions

class evennia.utils.tests.test_create_functions.TestCreateScript(methodName='runTest')[source]

Bases: evennia.utils.test_resources.EvenniaTest

test_create_script()[source]
test_create_script_w_repeats_equal_1()[source]
test_create_script_w_repeats_equal_1_and_delayed()[source]
test_create_script_w_repeats_equal_1_persisted()[source]
test_create_script_w_repeats_equal_2()[source]

evennia.utils.tests.test_eveditor module

Test eveditor

class evennia.utils.tests.test_eveditor.TestEvEditor(methodName='runTest')[source]

Bases: evennia.commands.default.tests.CommandTest

test_eveditor_COLON_DD()[source]
test_eveditor_COLON_F()[source]
test_eveditor_COLON_J()[source]
test_eveditor_COLON_UU()[source]
test_eveditor_bad_commands()[source]
test_eveditor_search_and_replace()[source]
test_eveditor_view_cmd()[source]

evennia.utils.tests.test_evform module

Unit tests for the EvForm text form generator

class evennia.utils.tests.test_evform.TestEvForm(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_ansi_escape()[source]
test_form()[source]

evennia.utils.tests.test_evmenu module

Unit tests for the EvMenu system

This sets up a testing parent for testing EvMenu trees. It is configured by subclassing the TestEvMenu class from this module and setting the class variables to point to the menu that should be tested and how it should be called.

Without adding any further test methods, the tester will process all nodes of the menu, depth first, by stepping through all options for every node. Optionally, it can check that all nodes are visited. It will create a hierarchical list of node names that describes the tree structure. This can then be compared against a template to make sure the menu structure is sound. Easiest way to use this is to run the test once to see how the structure looks.

The system also allows for testing the returns of each node as part of the parsing.

To help debug the menu, turn on debug_output, which will print the traversal process in detail.

class evennia.utils.tests.test_evmenu.TestEvMenu(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Run the EvMenu testing.

_debug_output(indent, msg)[source]
_test_menutree(menu)[source]

This is a automatic tester of the menu tree by recursively progressing through the structure.

auto_help = True
auto_look = True
auto_quit = True
cmd_on_exit = 'look'
cmdset_mergetype = 'Replace'
cmdset_priority = 1
debug_output = False
expect_all_nodes = False
expected_node_options = {}
expected_node_options_count = {}
expected_node_texts = {}
expected_tree = []
kwargs = {}
menutree = {}
persistent = False
setUp()[source]

Hook method for setting up the test fixture before exercising it.

startnode = 'start'
startnode_input = ''
test_menu_structure()[source]
class evennia.utils.tests.test_evmenu.TestEvMenuExample(methodName='runTest')[source]

Bases: evennia.utils.tests.test_evmenu.TestEvMenu

debug_output = False
expected_node_texts = {'test_view_node': 'Your name is'}
expected_tree = ['test_start_node', ['test_set_node', ['test_start_node'], 'test_look_node', ['test_start_node'], 'test_view_node', ['test_start_node'], 'test_dynamic_node', ['test_dynamic_node', 'test_dynamic_node', 'test_dynamic_node', 'test_dynamic_node', 'test_start_node'], 'test_end_node', 'test_displayinput_node', ['test_start_node']]]
kwargs = {'testval': 'val', 'testval2': 'val2'}
menutree = 'evennia.utils.evmenu'
startnode = 'test_start_node'
test_kwargsave()[source]

evennia.utils.tests.test_gametime module

Unit tests for the utilities of the evennia.utils.gametime module.

class evennia.utils.tests.test_gametime.TestGametime(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

setUp() → None[source]

Hook method for setting up the test fixture before exercising it.

tearDown() → None[source]

Hook method for deconstructing the test fixture after testing it.

test_game_epoch_no_setting()[source]
test_game_epoch_setting()[source]
test_gametime_absolute()[source]
test_gametime_downtimes()[source]
test_gametime_simple()[source]
test_real_seconds_until()[source]
test_real_seconds_until_behind()[source]
test_real_seconds_until_leap_year()[source]
test_repeat_schedule()[source]
test_runtime()[source]
test_schedule()[source]
test_server_epoch()[source]
test_uptime()[source]

evennia.utils.tests.test_tagparsing module

Unit tests for all sorts of inline text-tag parsing, like ANSI, html conversion, inlinefuncs etc

class evennia.utils.tests.test_tagparsing.ANSIStringTestCase(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

checker(ansi, raw, clean)[source]

Verifies the raw and clean strings of an ANSIString match expected output.

table_check(ansi, char, code)[source]

Verifies the indexes in an ANSIString match what they should.

test_add()[source]

Verify concatenation works correctly.

test_capitalize()[source]

Make sure that capitalization works. This is the simplest of the _transform functions.

test_instance()[source]

Make sure the ANSIString is always constructed correctly.

test_join()[source]

Verify that joining a set of ANSIStrings works.

test_len()[source]

Make sure that length reporting on ANSIStrings does not include ANSI codes.

test_mxp_agnostic()[source]

Make sure MXP tags are not treated like ANSI codes, but normal text.

test_slice()[source]

Verifies that slicing an ANSIString results in expected color code distribution.

test_split()[source]

Verifies that re.split and .split behave similarly and that color codes end up where they should.

test_strip()[source]

Test the ansi-aware .strip() methods

class evennia.utils.tests.test_tagparsing.TestInlineFuncs(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Test the nested inlinefunc module

test_escaped()[source]
test_escaped2()[source]
test_incomplete()[source]
test_nested()[source]
test_nofunc()[source]
test_single_func()[source]
class evennia.utils.tests.test_tagparsing.TestTextToHTMLparser(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_url_chars_anchor()[source]
test_url_chars_colon()[source]
test_url_chars_exclam()[source]
test_url_chars_querystring()[source]
test_url_chars_slash()[source]
test_url_edge_brackets()[source]
test_url_edge_following_htmlentity()[source]
test_url_edge_following_period()[source]
test_url_edge_following_period_eol()[source]
test_url_edge_leadingw()[source]
test_url_edge_multiline()[source]
test_url_edge_surrounded_spans()[source]
test_url_scheme_ftp()[source]
test_url_scheme_ftpproto()[source]
test_url_scheme_http()[source]
test_url_scheme_https()[source]
test_url_scheme_www()[source]

evennia.utils.tests.test_text2html module

Tests for text2html

class evennia.utils.tests.test_text2html.TestText2Html(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_convert_linebreaks()[source]
test_convert_urls()[source]
test_parse_html()[source]
test_re_blinking()[source]
test_re_bold()[source]
test_re_color()[source]
test_re_double_space()[source]
test_re_inversing()[source]
test_re_underline()[source]
test_remove_backspaces()[source]
test_remove_bells()[source]
test_sub_text()[source]

evennia.utils.tests.test_utils module

Unit tests for the utilities of the evennia.utils.utils module.

TODO: Not nearly all utilities are covered yet.

class evennia.utils.tests.test_utils.LatinifyTest(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_byte_string()[source]
test_plain_string()[source]
class evennia.utils.tests.test_utils.TestCrop(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_crop()[source]
class evennia.utils.tests.test_utils.TestDateTimeFormat(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_datetimes()[source]
class evennia.utils.tests.test_utils.TestDedent(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_dedent()[source]
class evennia.utils.tests.test_utils.TestFormatGrid(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

_generate_elements(basewidth, variation, amount)[source]
maxDiff = None
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_breakline()[source]

Grid with line-long elements in middle

test_disparate_grid()[source]

Grid with big variations

test_even_grid()[source]

Grid with small variations

test_huge_grid()[source]

Grid with very long strings

test_overlap()[source]

Grid with elements overlapping into the next slot

class evennia.utils.tests.test_utils.TestImportFunctions(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

_t_dir_file(filename)[source]
test_mod_import()[source]
test_mod_import_from_path()[source]
test_mod_import_from_path_invalid()[source]
test_mod_import_invalid()[source]
class evennia.utils.tests.test_utils.TestIsIter(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_is_iter()[source]
class evennia.utils.tests.test_utils.TestListToString(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Default function header from utils.py: list_to_string(inlist, endsep=”and”, addquote=False)

Examples

no endsep:

[1,2,3] -> ‘1, 2, 3’

with endsep==’and’:

[1,2,3] -> ‘1, 2 and 3’

with addquote and endsep

[1,2,3] -> ‘“1”, “2” and “3”’

test_list_to_string()[source]
class evennia.utils.tests.test_utils.TestMLen(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Verifies that m_len behaves like len in all situations except those where MXP may be involved.

test_dict()[source]
test_list()[source]
test_mxp_ansi_string()[source]
test_mxp_string()[source]
test_non_mxp_ansi_string()[source]
test_non_mxp_string()[source]
class evennia.utils.tests.test_utils.TestPercent(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Test the utils.percentage function.

test_bad_input()[source]

Gracefully handle weird input.

test_ok_input()[source]
class evennia.utils.tests.test_utils.TestTimeformat(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

Default function header from utils.py: time_format(seconds, style=0)

test_style_0()[source]

Test the style 0 of time_format.

test_style_1()[source]

Test the style 1 of time_format.

test_style_2()[source]

Test the style 2 of time_format.

test_style_3()[source]

Test the style 3 of time_format.

test_style_4()[source]

Test the style 4 of time_format.

test_unknown_format()[source]

Test that unknown formats raise exceptions.

evennia.utils.tests.test_validatorfuncs module

Tests for validatorfuncs

class evennia.utils.tests.test_validatorfuncs.TestValidatorFuncs(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

test_boolean()[source]
test_boolean_raises_ValueError()[source]
test_color_falsy_raises_ValueError()[source]
test_color_ok()[source]
test_datetime_ok()[source]
test_datetime_raises_ValueError()[source]
test_duration_ok()[source]
test_duration_raises_ValueError()[source]
test_email_ok()[source]
test_email_raises_ValueError()[source]
test_future_ok()[source]
test_future_raises_ValueError()[source]
test_lock_ok()[source]
test_lock_raises_ValueError()[source]
test_positive_integer_ok()[source]
test_positive_integer_raises_ValueError(mocked_int)[source]
test_signed_integer_ok()[source]
test_signed_integer_raises_ValueError(mocked_int)[source]
test_text_ok()[source]
test_text_raises_ValueError(mocked_str)[source]
test_timezone_ok()[source]
test_timezone_raises_ValueError()[source]
test_unsigned_integer_ok()[source]
test_unsigned_integer_raises_ValueError(mocked_int)[source]