# evennia.contrib.grid.xyzgrid.tests

Tests for the XYZgrid system.

class `evennia.contrib.grid.xyzgrid.tests.``TestMap1`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test the Map class with a simple 4-node map

  `test_str_output`()

    Check the display_map

  `test_node_from_coord`()
  `test_get_shortest_path`()
  `test_get_visual_range__scan` = None
  `test_get_visual_range__scan__character` = None
  `test_get_visual_range__nodes__character` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_get_visual_range__nodes__character_0`()

    Get sub-part of map with node-mode [with coord=(0, 0), dist=1, expected=’# n| n@-#’].

  `test_get_visual_range__nodes__character_1`()

    Get sub-part of map with node-mode [with coord=(0, 1), dist=1, expected=’@-#n| n# ‘].

  `test_get_visual_range__nodes__character_2`()

    Get sub-part of map with node-mode [with coord=(1, 0), dist=1, expected=’ #n |n#-@’].

  `test_get_visual_range__nodes__character_3`()

    Get sub-part of map with node-mode [with coord=(1, 1), dist=1, expected=’#-@n |n #’].

  `test_get_visual_range__nodes__character_4`()

    Get sub-part of map with node-mode [with coord=(0, 0), dist=2, expected=’#-#n| |n@-#’].

  `test_get_visual_range__scan_0`()

    Test displaying a part of the map around a central point [with coord=(0, 0), expectstr=’| n#-’, expectlst=[[‘|’, ‘ ‘], [‘#’, ‘-‘]]].

  `test_get_visual_range__scan_1`()

    Test displaying a part of the map around a central point [with coord=(1, 0), expectstr=’ |\n-#', expectlst=[[' ', '|’], [‘-’, ‘#’]]].

  `test_get_visual_range__scan_2`()

    Test displaying a part of the map around a central point [with coord=(0, 1), expectstr=’#-n| ‘, expectlst=[[‘#’, ‘-‘], [‘|’, ‘ ‘]]].

  `test_get_visual_range__scan_3`()

    Test displaying a part of the map around a central point [with coord=(1, 1), expectstr=’-#n |', expectlst=[['-', '#'], [' ', '|’]]].

  `test_get_visual_range__scan__character_0`()

    Test displaying a part of the map around a central point, showing the [with coord=(0, 0), expectstr=’| n@-’, expectlst=[[‘|’, ‘ ‘], [‘@’, ‘-‘]]] character @-symbol in that spot.

  `test_get_visual_range__scan__character_1`()

    Test displaying a part of the map around a central point, showing the [with coord=(1, 0), expectstr=’ |\n-@', expectlst=[[' ', '|’], [‘-’, ‘@’]]] character @-symbol in that spot.

  `test_get_visual_range__scan__character_2`()

    Test displaying a part of the map around a central point, showing the [with coord=(0, 1), expectstr=’@-n| ‘, expectlst=[[‘@’, ‘-‘], [‘|’, ‘ ‘]]] character @-symbol in that spot.

  `test_get_visual_range__scan__character_3`()

    Test displaying a part of the map around a central point, showing the [with coord=(1, 1), expectstr=’-@n |', expectlst=[['-', '@'], [' ', '|’]]] character @-symbol in that spot.

class `evennia.contrib.grid.xyzgrid.tests.``TestMap2`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test with Map2 - a bigger map with multi-step links

  `map_data` = {'map': '\n\n + 0 1 2 3 4 5\n\n 5 #-#-#-#-#\n | |\n 4 #---#\n | |\n 3 # | #-#\n | | |\n 2 #-#-#-#---#\n | |\n 1 #-#-#---#-#\n | |\n 0 #-#-#-#\n\n + 0 1 2 3 4 5\n\n', 'zcoord': 'map2'}
  `map_display` = '#-#-#-#-#\n | |\n #---#\n | |\n# | #-#\n| | |\n#-#-#-#---#\n| |\n#-#-#---#-#\n | |\n #-#-#-#'
  `test_str_output`()

    Check the display_map

  `test_node_from_coord`()
  `test_shortest_path` = None
  `test_get_visual_range__scan__character` = None
  `test_extended_path_tracking__horizontal`()

    Crossing multi-gridpoint links should be tracked properly.

  `test_extended_path_tracking__vertical`()

    Testing multi-gridpoint links in the vertical direction.

  `test_get_visual_range__nodes__character` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_get_visual_range__nodes__character_0`()

    Get sub-part of map with node-mode [with coord=(0, 0), dist=2, max_size=None, expected=’@’].

  `test_get_visual_range__nodes__character_1`()

    Get sub-part of map with node-mode [with coord=(4, 5), dist=0, max_size=None, expected=’@’].

  `test_get_visual_range__nodes__character_2`()

    Get sub-part of map with node-mode [with coord=(1, 0), dist=2, max_size=None, expected=’#-#-# n | n @-#-#’].

  `test_get_visual_range__nodes__character_3`()

    Get sub-part of map with node-mode [with coord=(0, 5), dist=1, max_size=None, expected=’@-#’].

  `test_get_visual_range__nodes__character_4`()

    Get sub-part of map with node-mode [with coord=(0, 5), dist=4, max_size=None, expected=’@-#-#-#-#n | n #—#… | n | n # ‘].

  `test_get_visual_range__nodes__character_5`()

    Get sub-part of map with node-mode [with coord=(5, 1), dist=3, max_size=None, expected=’ # n | n#-#—#-@n | n #-# ‘].

  `test_get_visual_range__nodes__character_6`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=2, max_size=None, expected=’ # n | n #…#—#n | n #-#—# ‘].

  `test_get_visual_range__nodes__character_7`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=2, max_size=(5, 5), expected=’ | n | n#-@-#n | n#-#–‘].

  `test_get_visual_range__nodes__character_8`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=4, max_size=(3, 3), expected=’ | n-@-n | ‘].

  `test_get_visual_range__nodes__character_9`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=4, max_size=(1, 1), expected=’@’].

  `test_get_visual_range__scan__character_0`()

    Test showing smaller part of grid, showing @-character in the middle [with coord=(1, 0), expected=’#-#-#-#n| | n#-#-#–n | n @-#-#’].

  `test_get_visual_range__scan__character_1`()

    Test showing smaller part of grid, showing @-character in the middle [with coord=(2, 2), expected=’ #—#n | |n# | #…#-#-#—#n | |n #-#-#-#’].

  `test_get_visual_range__scan__character_2`()

    Test showing smaller part of grid, showing @-character in the middle [with coord=(4, 5), expected=’#-#-@ n| | n#—# n| | n| #-#’].

  `test_get_visual_range__scan__character_3`()

    Test showing smaller part of grid, showing @-character in the middle [with coord=(5, 2), expected=’–# n | n #-#n |n#—@n n–#-#n | n#-# ‘].

  `test_shortest_path_0`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(4, 0), expected_directions=(‘e’, ‘e’, ‘e’)].

  `test_shortest_path_1`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(5, 1), expected_directions=(‘n’, ‘e’, ‘e’, ‘e’)].

  `test_shortest_path_2`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 2), endcoord=(2, 5), expected_directions=(‘n’, ‘n’)].

  `test_shortest_path_3`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 4), endcoord=(0, 5), expected_directions=(‘w’, ‘n’, ‘w’, ‘w’)].

  `test_shortest_path_4`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 0), endcoord=(0, 5), expected_directions=(‘n’, ‘w’, ‘n’, ‘n’, ‘n’, ‘w’, ‘w’)].

  `test_shortest_path_5`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 0), endcoord=(0, 5), expected_directions=(‘n’, ‘w’, ‘n’, ‘n’, ‘n’, ‘w’, ‘w’)].

  `test_shortest_path_6`()

    Test shortest-path calculations throughout the grid [with startcoord=(5, 3), endcoord=(0, 3), expected_directions=(‘s’, ‘w’, ‘w’, ‘w’, ‘w’, ‘n’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap3`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map3 - Map with diagonal links

  `map_data` = {'map': '\n\n + 0 1 2 3 4 5\n\n 5 #-#---# #\n | / \\ /\n 4 # / #\n |/ |\n 3 # #\n |\\ / \\\n 2 # #-# #\n |/ \\ /\n 1 # #\n / \\ |\n 0 # #---#-#\n\n + 0 1 2 3 4 5\n\n', 'zcoord': 'map3'}
  `map_display` = '#-#---# #\n | / \\ /\n # / #\n |/ |\n # #\n |\\ / \\\n # #-# #\n |/ \\ /\n # #\n / \\ |\n# #---#-#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_get_visual_range__nodes__character` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_get_visual_range__nodes__character_0`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=2, max_size=None, expected=’ # n / n # / … # #n / \ n# # ‘].

  `test_get_visual_range__nodes__character_1`()

    Get sub-part of map with node-mode [with coord=(5, 2), dist=2, max_size=None, expected=’ # n | n # n / \ n# … @n \ / n # n | n # ‘].

  `test_shortest_path_00`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(1, 0), expected_directions=()].

  `test_shortest_path_01`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 0), endcoord=(5, 0), expected_directions=(‘e’, ‘e’)].

  `test_shortest_path_02`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(1, 1), expected_directions=(‘ne’,)].

  `test_shortest_path_03`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 1), endcoord=(4, 3), expected_directions=(‘nw’, ‘ne’)].

  `test_shortest_path_04`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 1), endcoord=(4, 3), expected_directions=(‘nw’, ‘ne’)].

  `test_shortest_path_05`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 2), endcoord=(3, 5), expected_directions=(‘nw’, ‘ne’)].

  `test_shortest_path_06`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 2), endcoord=(1, 5), expected_directions=(‘nw’, ‘n’, ‘n’)].

  `test_shortest_path_07`()

    Test shortest-path calculations throughout the grid [with startcoord=(5, 5), endcoord=(0, 0), expected_directions=(‘sw’, ‘s’, ‘sw’, ‘w’, ‘sw’, ‘sw’)].

  `test_shortest_path_08`()

    Test shortest-path calculations throughout the grid [with startcoord=(5, 5), endcoord=(0, 0), expected_directions=(‘sw’, ‘s’, ‘sw’, ‘w’, ‘sw’, ‘sw’)].

  `test_shortest_path_09`()

    Test shortest-path calculations throughout the grid [with startcoord=(5, 2), endcoord=(1, 2), expected_directions=(‘sw’, ‘nw’, ‘w’, ‘nw’, ‘s’)].

  `test_shortest_path_10`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 1), endcoord=(1, 1), expected_directions=(‘s’, ‘w’, ‘nw’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap4`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map4 - Map with + and x crossing links

  `map_data` = {'map': '\n\n + 0 1 2 3 4\n\n 4 #-# #---#\n x /\n 3 #-#-#\n |x x|\n 2 #-#-#-#\n | | |\n 1 #-+-#-+-#\n | |\n 0 #---#\n\n + 0 1 2 3 4\n\n', 'zcoord': 'map4'}
  `map_display` = '#-# #---#\n x /\n #-#-#\n |x x|\n#-#-#-#\n| | |\n#-+-#-+-#\n | |\n #---#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_shortest_path_0`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(1, 2), expected_directions=(‘n’,)].

  `test_shortest_path_1`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 1), endcoord=(2, 1), expected_directions=(‘e’,)].

  `test_shortest_path_2`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 1), endcoord=(1, 0), expected_directions=(‘w’, ‘w’, ‘n’, ‘e’, ‘s’)].

  `test_shortest_path_3`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 2), endcoord=(2, 3), expected_directions=(‘ne’,)].

  `test_shortest_path_4`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 2), endcoord=(2, 3), expected_directions=(‘ne’,)].

  `test_shortest_path_5`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 2), endcoord=(0, 4), expected_directions=(‘w’, ‘ne’, ‘nw’, ‘w’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap5`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map5 - Small map with one-way links

  `map_data` = {'map': '\n\n+ 0 1 2\n\n2 #-#\n | |\n1 #>#\n\n0 #>#\n\n+ 0 1 2\n\n', 'zcoord': 'map5'}
  `map_display` = '#-#\n| |\n#>#\n\n#>#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_shortest_path_0`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(1, 0), expected_directions=(‘e’,)].

  `test_shortest_path_1`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(0, 0), expected_directions=()].

  `test_shortest_path_2`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 1), endcoord=(1, 1), expected_directions=(‘e’,)].

  `test_shortest_path_3`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 1), endcoord=(0, 1), expected_directions=(‘n’, ‘w’, ‘s’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap6`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map6 - Bigger map with one-way links in different directions

  `map_data` = {'map': '\n\n + 0 1 2 3 4\n\n 4 #-#-#-#\n ^ |\n 3 | #>#\n | | |\n 2 #-#-#-#\n ^ v\n 1 #---#-#\n | | |\n 0 #-#>#-#<#\n\n + 0 1 2 3 4\n\n', 'zcoord': 'map6'}
  `map_display` = '#-#-#-#\n ^ |\n | #>#\n | | |\n #-#-#-#\n ^ v\n #---#-#\n | | |\n#-#>#-#<#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_shortest_path_0`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(2, 0), expected_directions=(‘e’, ‘e’)].

  `test_shortest_path_1`()

    Test shortest-path calculations throughout the grid [with startcoord=(2, 0), endcoord=(0, 0), expected_directions=(‘e’, ‘n’, ‘w’, ‘s’, ‘w’)].

  `test_shortest_path_2`()

    Test shortest-path calculations throughout the grid [with startcoord=(4, 0), endcoord=(3, 0), expected_directions=(‘w’,)].

  `test_shortest_path_3`()

    Test shortest-path calculations throughout the grid [with startcoord=(3, 0), endcoord=(4, 0), expected_directions=(‘n’, ‘e’, ‘s’)].

  `test_shortest_path_4`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 1), endcoord=(1, 2), expected_directions=(‘n’,)].

  `test_shortest_path_5`()

    Test shortest-path calculations throughout the grid [with startcoord=(1, 2), endcoord=(1, 1), expected_directions=(‘e’, ‘e’, ‘s’, ‘w’)].

  `test_shortest_path_6`()

    Test shortest-path calculations throughout the grid [with startcoord=(3, 1), endcoord=(1, 4), expected_directions=(‘w’, ‘n’, ‘n’)].

  `test_shortest_path_7`()

    Test shortest-path calculations throughout the grid [with startcoord=(0, 4), endcoord=(0, 0), expected_directions=(‘e’, ‘e’, ‘e’, ‘s’, ‘s’, ‘s’, ‘w’, ‘s’, ‘w’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap7`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map7 - Small test of dynamic link node

  `map_data` = {'map': '\n+ 0 1 2\n\n2 #-#\n |\n1 #-o-#\n |\n0 #-#\n\n+ 0 1 2\n\n', 'zcoord': 'map7'}
  `map_display` = '#-#\n |\n#-o-#\n |\n #-#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(1, 2), expected_directions=(‘n’,)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 2), endcoord=(1, 0), expected_directions=(‘s’,)].

  `test_shortest_path_2`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 1), endcoord=(2, 1), expected_directions=(‘e’,)].

  `test_shortest_path_3`()

    test shortest-path calculations throughout the grid [with startcoord=(2, 1), endcoord=(0, 1), expected_directions=(‘w’,)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap8`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map8 - Small test of dynamic link node

  `map_data` = {'map': '\n+ 0 1 2 3 4 5\n\n4 #-#-o o o-o\n | \\|/| | |\n3 #-o-o-# o-#\n | /|\\ |\n2 o-o-#-# o\n | | /\n1 #-o-#-o-#\n | /\n0 #---#-o\n\n+ 0 1 2 3 4 5\n\n', 'zcoord': 'map8'}
  `map_display` = '#-#-o o o-o\n| \\|/| | |\n#-o-o-# o-#\n| /|\\ |\no-o-#-# o\n | | /\n #-o-#-o-#\n | /\n#---#-o'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_get_visual_range__nodes__character` = None
  `test_get_visual_range_with_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_get_visual_range__nodes__character_0`()

    Get sub-part of map with node-mode [with coord=(2, 2), dist=1, max_size=None, expected=’ #-o n | n# o n| … | n o n | n # ‘].

  `test_get_visual_range_with_path_0`()

    Get visual range with a path-to-target marked [with coord=(2, 2), target=(3, 2), dist=1, max_size=None, expected=’ #-o n | n# o n| … | n o n | n # ‘].

  `test_get_visual_range_with_path_1`()

    Get visual range with a path-to-target marked [with coord=(2, 2), target=(5, 3), dist=1, max_size=None, expected=’ #-o n | n# o n| … . n . n . n …’].

  `test_get_visual_range_with_path_2`()

    Get visual range with a path-to-target marked [with coord=(2, 2), target=(5, 3), dist=2, max_size=None, expected=’#-#-o n| \| n#-o-… . n . . n#—… ‘].

  `test_get_visual_range_with_path_3`()

    Get visual range with a path-to-target marked [with coord=(5, 3), target=(2, 2), dist=2, max_size=(13, 7), expected=’ o-on | |n o-@n .n. .n. . ‘].

  `test_get_visual_range_with_path_4`()

    Get visual range with a path-to-target marked [with coord=(5, 3), target=(1, 1), dist=2, max_size=None, expected=’ o-on | |n … . n . . n#—… ‘].

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(2, 0), endcoord=(2, 2), expected_directions=(‘n’,)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(5, 3), expected_directions=(‘e’, ‘e’)].

  `test_shortest_path_2`()

    test shortest-path calculations throughout the grid [with startcoord=(5, 1), endcoord=(0, 3), expected_directions=(‘w’, ‘w’, ‘n’, ‘w’)].

  `test_shortest_path_3`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 1), endcoord=(2, 2), expected_directions=(‘n’, ‘w’, ‘s’)].

  `test_shortest_path_4`()

    test shortest-path calculations throughout the grid [with startcoord=(5, 3), endcoord=(5, 3), expected_directions=()].

  `test_shortest_path_5`()

    test shortest-path calculations throughout the grid [with startcoord=(5, 3), endcoord=(0, 4), expected_directions=(‘s’, ‘n’, ‘w’, ‘n’)].

  `test_shortest_path_6`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 4), endcoord=(3, 3), expected_directions=(‘e’, ‘w’, ‘e’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap9`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map9 - a map with up/down links.

  `map_data` = {'map': '\n+ 0 1 2 3\n\n3 #-#-#-#\n d d d\n2 | | |\n u u u\n1 #-# #-#\n u d\n0 #d# #u#\n\n+ 0 1 2 3\n\n', 'zcoord': 'map9'}
  `map_display` = '#-#-#-#\n d d d\n | | |\n u u u\n#-# #-#\nu d\n#d# #u#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(0, 1), expected_directions=(‘u’,)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(1, 0), expected_directions=(‘d’,)].

  `test_shortest_path_2`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(2, 1), expected_directions=(‘d’, ‘u’, ‘e’, ‘u’, ‘e’, ‘d’)].

  `test_shortest_path_3`()

    test shortest-path calculations throughout the grid [with startcoord=(2, 1), endcoord=(0, 1), expected_directions=(‘u’, ‘w’, ‘d’, ‘w’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap10`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map10 - a map with blocked- and interrupt links/nodes. These are ‘invisible’ nodes and won’t show up in the map display.

  `map_data` = {'map': '\n\n + 0 1 2 3\n\n 4 #---#-#\n b |\n 3 #i#---#\n |/|\n 2 # #-I-#\n |\n 1 #-#b#-#\n | | b\n 0 #b#-#-#\n\n + 0 1 2 3\n\n', 'zcoord': 'map10'}
  `map_display` = '#---#-#\n / |\n#-#---#\n|/|\n# #-#-#\n |\n#-#-#-#\n| | |\n#-#-#-#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_paths` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_paths_0`()

    Test path locations [with startcoord=(2, 2), endcoord=(3, 2), expected_directions=(‘e’,), expected_path=((2, 2), (2.5, 2), (3, 2))].

  `test_paths_1`()

    Test path locations [with startcoord=(3, 3), endcoord=(0, 3), expected_directions=(‘w’, ‘w’), expected_path=((3, 3), (2.5, 3.0), (2.0, 3.0),… 3.0), (1, 3), (0.5, 3), (0, 3))].

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 0), endcoord=(1, 0), expected_directions=(‘n’, ‘e’, ‘s’)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(3, 0), endcoord=(3, 1), expected_directions=()].

  `test_shortest_path_2`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 3), endcoord=(0, 4), expected_directions=(‘e’, ‘n’, ‘w’, ‘w’)].

  `test_shortest_path_3`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 1), endcoord=(3, 2), expected_directions=(‘e’, ‘n’, ‘e’, ‘e’)].

  `test_shortest_path_4`()

    test shortest-path calculations throughout the grid [with startcoord=(0, 1), endcoord=(0, 3), expected_directions=(‘e’, ‘n’, ‘n’, ‘w’)].

  `test_shortest_path_5`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 3), endcoord=(0, 3), expected_directions=(‘w’,)].

  `test_shortest_path_6`()

    test shortest-path calculations throughout the grid [with startcoord=(3, 2), endcoord=(2, 2), expected_directions=(‘w’,)].

  `test_shortest_path_7`()

    test shortest-path calculations throughout the grid [with startcoord=(3, 2), endcoord=(1, 2), expected_directions=(‘w’, ‘w’)].

  `test_shortest_path_8`()

    test shortest-path calculations throughout the grid [with startcoord=(3, 3), endcoord=(0, 3), expected_directions=(‘w’, ‘w’)].

  `test_shortest_path_9`()

    test shortest-path calculations throughout the grid [with startcoord=(2, 2), endcoord=(3, 2), expected_directions=(‘e’,)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMap11`(methodName='runTest')

  Bases: `evennia.contrib.grid.xyzgrid.tests._MapTest`

  Test Map11 - a map teleporter links.

  `map_data` = {'map': '\n\n+ 0 1 2 3\n\n2 #-#\n \\\n1 t t\n \\\n0 #-#\n\n+ 0 1 2 3\n\n', 'zcoord': 'map11'}
  `map_display` = '#-#\n \\\n\n \\\n #-#'
  `test_str_output`()

    Check the display_map

  `test_shortest_path` = None
  `test_paths` = None
  `test_get_visual_range_with_path` = None
  `test_spawn`()

    Spawn the map into actual objects.

  `test_get_visual_range_with_path_0`()

    Get visual range with a path-to-target marked [with coord=(2, 0), target=(1, 2), dist=3, max_size=None, expected=’… n . n . . n . n @..’].

  `test_get_visual_range_with_path_1`()

    Get visual range with a path-to-target marked [with coord=(1, 2), target=(2, 0), dist=3, max_size=None, expected=’..@ n . n . . n . n …’].

  `test_paths_0`()

    Test path locations [with startcoord=(3, 0), endcoord=(0, 2), expected_directions=(‘nw’,), expected_path=((3, 0), (2.5, 0.5), (2.0, 1.0), (1.0, 1.0), (0.5, 1.5), (0, 2))].

  `test_paths_1`()

    Test path locations [with startcoord=(0, 2), endcoord=(3, 0), expected_directions=(‘se’,), expected_path=((0, 2), (0.5, 1.5), (1.0, 1.0), (2.0, 1.0), (2.5, 0.5), (3, 0))].

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(2, 0), endcoord=(1, 2), expected_directions=(‘e’, ‘nw’, ‘e’)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 2), endcoord=(2, 0), expected_directions=(‘w’, ‘se’, ‘w’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestMapStressTest`(methodName='runTest')

  Bases: `django.test.testcases.TestCase`

  Performance test of map patfinder and visualizer.

  |x|x|x|x| -#-#-#-# ——– |x|x|x|x| -#-#-#-# ——– |x|x|x|x| -#-#-#-# ——– …

  This should be a good stress-testing scenario because most each internal node has a maxiumum number of connections and options to consider.

  `test_grid_creation` = None
  `test_grid_pathfind` = None
  `test_grid_visibility` = None
  `test_grid_creation_0`()

    Test of grid-creataion performance for Nx, Ny grid [with gridsize=(10, 10), max_time=0.03].

  `test_grid_creation_1`()

    Test of grid-creataion performance for Nx, Ny grid [with gridsize=(100, 100), max_time=5].

  `test_grid_pathfind_0`()

    Test pathfinding performance for Nx, Ny grid [with gridsize=(10, 10), max_time=0.001].

  `test_grid_pathfind_1`()

    Test pathfinding performance for Nx, Ny grid [with gridsize=(20, 20), max_time=0.001].

  `test_grid_visibility_0`()

    Test grid visualization performance for Nx, Ny grid for [with gridsize=(10, 10), dist=4, max_time=0.01] different visibility distances.

  `test_grid_visibility_1`()

    Test grid visualization performance for Nx, Ny grid for [with gridsize=(20, 20), dist=4, max_time=0.01] different visibility distances.

class `evennia.contrib.grid.xyzgrid.tests.``TestXYZGrid`(methodName='runTest')

  Bases: `evennia.utils.test_resources.BaseEvenniaTest`

  Test base grid class with a single map, including spawning objects.

  `zcoord` = 'map1'
  `setUp`()

    Sets up testing environment

  `tearDown`()

    Hook method for deconstructing the test fixture after testing it.

  `test_str_output`()

    Check the display_map

  `test_spawn`()

    Spawn objects for the grid

class `evennia.contrib.grid.xyzgrid.tests.``Map12aTransition`(x, y, Z, node_index=0, symbol=None, xymap=None)

  Bases: `evennia.contrib.grid.xyzgrid.xymap_legend.TransitionMapNode`

  `symbol` = 'T'
  `target_map_xyz` = (1, 0, 'map12b')

class `evennia.contrib.grid.xyzgrid.tests.``Map12bTransition`(x, y, Z, node_index=0, symbol=None, xymap=None)

  Bases: `evennia.contrib.grid.xyzgrid.xymap_legend.TransitionMapNode`

  `symbol` = 'T'
  `target_map_xyz` = (0, 1, 'map12a')

class `evennia.contrib.grid.xyzgrid.tests.``TestXYZGridTransition`(methodName='runTest')

  Bases: `evennia.utils.test_resources.BaseEvenniaTest`

  Test the XYZGrid class and transitions between maps.

  `setUp`()

    Sets up testing environment

  `tearDown`()

    Hook method for deconstructing the test fixture after testing it.

  `test_shortest_path` = None
  `test_spawn`()

    Spawn the two maps into actual objects.

  `test_shortest_path_0`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 0), endcoord=(1, 1), expected_directions=(‘w’, ‘n’, ‘e’)].

  `test_shortest_path_1`()

    test shortest-path calculations throughout the grid [with startcoord=(1, 1), endcoord=(1, 0), expected_directions=(‘w’, ‘s’, ‘e’)].

class `evennia.contrib.grid.xyzgrid.tests.``TestBuildExampleGrid`(methodName='runTest')

  Bases: `evennia.utils.test_resources.BaseEvenniaTest`

  Test building the map-example (this takes about 30s)

  `setUp`()

    Sets up testing environment

  `tearDown`()

    Hook method for deconstructing the test fixture after testing it.

  `test_build`()

    Build the map example.