diff --git a/evennia/utils/tests/test_utils.py b/evennia/utils/tests/test_utils.py index b48d42644c..6fd4d65b52 100644 --- a/evennia/utils/tests/test_utils.py +++ b/evennia/utils/tests/test_utils.py @@ -68,6 +68,8 @@ class TestListToString(TestCase): [1,2,3] -> '1; 2; 3' with endsep=='and': [1,2,3] -> '1, 2 and 3' + with endsep=='': + [1,2,3] -> '1, 2 3' with addquote and endsep="and" [1,2,3] -> '"1", "2" and "3"' """ @@ -76,6 +78,7 @@ class TestListToString(TestCase): self.assertEqual("1, 2, and 3", utils.list_to_string([1, 2, 3])) self.assertEqual("1, 2, 3", utils.list_to_string([1, 2, 3], endsep=",")) self.assertEqual("1, 2 and 3", utils.list_to_string([1, 2, 3], endsep="and")) + self.assertEqual("1, 2 3", utils.list_to_string([1, 2, 3], endsep="")) self.assertEqual("1; 2; 3", utils.list_to_string([1, 2, 3], sep=";", endsep=";")) self.assertEqual('"1", "2", "3"', utils.list_to_string([1, 2, 3], endsep=",", addquote=True)) self.assertEqual( diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index ec7ef37ff2..701fad2e67 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -388,6 +388,8 @@ def iter_to_str(iterable, sep=",", endsep=", and", addquote=False): ```python >>> list_to_string([1,2,3], endsep=',') '1, 2, 3' + >>> list_to_string([1,2,3], endsep='') + '1, 2 3' >>> list_to_string([1,2,3], ensdep='and') '1, 2 and 3' >>> list_to_string([1,2,3], sep=';', endsep=';')