Esempio 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)
Esempio 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)
Esempio 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")
Esempio 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)
Esempio 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")
Esempio 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)
Esempio 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)
Esempio 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)