Exemplo n.º 1
0
    def test_split_empty_symbol(self):
        """
        Case: split by empty symbol separator.
        Expected: ValueError raise.
        """
        string_to_split, symbol_by_split = 'GameofThrones', ''
        expected_error = ValueError

        with self.assertRaises(expected_error):
            split(string_to_split, symbol_by_split)
Exemplo n.º 2
0
    def test_split(self, string_to_split, symbol_by_split):
        """
        Test overall split cases.
        """
        expected = ['Game', 'of', 'Thrones']
        response = split(string_to_split, symbol_by_split)

        self.assertEqual(expected, response)
Exemplo n.º 3
0
    def test_split_none(self):
        """
        Case: split by None separator.
        Expected: split works with None separator as like space symbol.
        """
        string_to_split, symbol_by_split = 'GameofThrones', None
        expected = ['GameofThrones']

        response = split(string_to_split, symbol_by_split)

        self.assertEqual(expected, response)
Exemplo n.º 4
0
def make_suitable_url_parameters(url_parameter):
    """
    Return a lowercase string with hyphen.
    """
    return join(split(url_parameter, ' '), '-').lower()