def test_empty_list_returns_empty_string(self): the_list = [] delimiter = ' ' expected = '' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)
def test_multi_level_nested_list(self): the_list = ['a', ['b', ['c', [[['x', 'y']]]]], 'z'] delimiter = ' ' expected = 'a b c x y z' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)
def test_list_to_string_passes_through_other_objects(self): self.assertIs(helpers.list_to_string(None, "foo"), None) self.assertIs(helpers.list_to_string(42, "foo"), 42) self.assertIs(helpers.list_to_string("foo bar", "foo"), "foo bar")
def test_simple_nested_list(self): the_list = ['a', 'bc', ['x', 'y', 'z'], 'def'] delimiter = ' ' expected = 'a bc x y z def' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)
def test_list_to_string_passes_through_other_objects(self): self.assertIs(helpers.list_to_string(None, "foo"), None) self.assertIs(helpers.list_to_string(42, "foo"), 42) self.assertIs(helpers.list_to_string("foo bar", "foo"), "foo bar")
def test_multi_level_nested_list(self): the_list = ['a', ['b', ['c', [[['x', 'y']]]]], 'z'] delimiter = ' ' expected = 'a b c x y z' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)
def test_simple_nested_list(self): the_list = ['a', 'bc', ['x', 'y', 'z'], 'def'] delimiter = ' ' expected = 'a bc x y z def' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)
def test_empty_list_returns_empty_string(self): the_list = [] delimiter = ' ' expected = '' actual = helpers.list_to_string(the_list, delimiter) self.assertEqual(actual, expected)