Ejemplo n.º 1
0
 def test_empty_list_returns_empty_string(self):
     the_list = []
     delimiter = ' '
     expected = ''
     actual = helpers.list_to_string(the_list, delimiter)
     self.assertEqual(actual, expected)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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")
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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")
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 def test_empty_list_returns_empty_string(self):
     the_list = []
     delimiter = ' '
     expected = ''
     actual = helpers.list_to_string(the_list, delimiter)
     self.assertEqual(actual, expected)