diff --git a/evennia/contrib/map_and_pathfind/tests.py b/evennia/contrib/map_and_pathfind/tests.py index fbd7515a48..fd373d0f89 100644 --- a/evennia/contrib/map_and_pathfind/tests.py +++ b/evennia/contrib/map_and_pathfind/tests.py @@ -4,9 +4,9 @@ Tests for the Mapsystem """ -from unittest import TestCase, mock -from . import mapsystem +from unittest import TestCase from parameterized import parameterized +from . import mapsystem MAP1 = """ @@ -20,6 +20,7 @@ MAP1 = """ + 0 1 2 """ + MAP1_DISPLAY = """ #-# | | @@ -27,6 +28,41 @@ MAP1_DISPLAY = """ """.strip() +MAP2 = """ + + + 0 1 2 3 4 5 + + 5 #-#-#-#-# + | | + 4 #---# + | | + 3 # | #-# + | | | + 2 #-#-#-#---# + | | + 1 #-#-#---#-# + | | + 0 #-#-#-# + + + 0 1 2 3 4 5 + +""" + +MAP2_DISPLAY = """ +#-#-#-#-# + | | + #---# + | | +# | #-# +| | | +#-#-#-#---# +| | +#-#-#---#-# + | | + #-#-#-# +""".strip() + + class TestMap1(TestCase): """ Test the Map class with a simple map and default symbol legend. @@ -77,3 +113,16 @@ class TestMap1(TestCase): lst = self.map.get_map_display(coord, dist=1, return_str=False, character='@') self.assertEqual(string, expectstr) self.assertEqual(lst, expectlst) + + +class TestMap2(TestCase): + """ + Test with Map2 - a bigger map with some links crossing nodes. + + """ + def setUp(self): + self.map = mapsystem.Map({"map": MAP2}) + + def test_str_output(self): + """Check the display_map""" + self.assertEqual(str(self.map).strip(), MAP2_DISPLAY)