Repository: joke2k/faker

Issue:
Random sentence of length 1 fails
* Faker version: 5.5.0
* OS: Ubuntu 20.04.1

Creating a random sentence of length 1 fails because it attempts to titleize the first word of the sentence, but `random_choices`  is returning a tuple which is immutable. 

This also occurs sometimes with 2 or 3 length sentences, although I presume that under the hood they are randomly selecting sentences of length 1.

This works as expected in Faker version 5.4.1.

### Steps to reproduce

```
>>> import faker
>>> thing = faker.Faker()
>>> print(thing.sentence(1))
```

### Expected behavior

A random titleized word is printed with a fullstop

### Actual behavior

```
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "~/.../venv/lib/python3.6/site-packages/faker/providers/lorem/__init__.py", line 86, in sentence
    words[0] = words[0].title()
TypeError: 'tuple' object does not support item assignment
```

Random sentence of length 1 fails
* Faker version: 5.5.0
* OS: Ubuntu 20.04.1

Creating a random sentence of length 1 fails because it attempts to titleize the first word of the sentence, but `random_choices`  is returning a tuple which is immutable. 

This also occurs sometimes with 2 or 3 length sentences, although I presume that under the hood they are randomly selecting sentences of length 1.

This works as expected in Faker version 5.4.1.

### Steps to reproduce

```
>>> import faker
>>> thing = faker.Faker()
>>> print(thing.sentence(1))
```

### Expected behavior

A random titleized word is printed with a fullstop

### Actual behavior

```
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "~/.../venv/lib/python3.6/site-packages/faker/providers/lorem/__init__.py", line 86, in sentence
    words[0] = words[0].title()
TypeError: 'tuple' object does not support item assignment
```



Discussion:

Resolving patch:
diff --git a/faker/providers/lorem/__init__.py b/faker/providers/lorem/__init__.py
--- a/faker/providers/lorem/__init__.py
+++ b/faker/providers/lorem/__init__.py
@@ -22,7 +22,7 @@ class Provider(BaseProvider):
     sentence_punctuation = '.'
 
     def words(self, nb=3, ext_word_list=None, unique=False):
-        """Generate a list of words.
+        """Generate a tuple of words.
 
         The ``nb`` argument controls the number of words in the resulting list,
         and if ``ext_word_list`` is provided, words from that list will be used
@@ -82,7 +82,7 @@ def sentence(self, nb_words=6, variable_nb_words=True, ext_word_list=None):
         if variable_nb_words:
             nb_words = self.randomize_nb_elements(nb_words, min=1)
 
-        words = self.words(nb=nb_words, ext_word_list=ext_word_list)
+        words = list(self.words(nb=nb_words, ext_word_list=ext_word_list))
         words[0] = words[0].title()
 
         return self.word_connector.join(words) + self.sentence_punctuation


Test patch:
diff --git a/tests/providers/test_lorem.py b/tests/providers/test_lorem.py
--- a/tests/providers/test_lorem.py
+++ b/tests/providers/test_lorem.py
@@ -88,6 +88,10 @@ def test_sentences(self, faker, num_samples):
                 words = sentence.lower().replace('.', '').split()
                 assert all(isinstance(word, str) and word in self.custom_word_list for word in words)
 
+    def test_sentence_single_word(self, faker):
+        word = faker.sentence(1)
+        assert str.isupper(word[0])
+
     def test_paragraph_no_sentences(self, faker, num_samples):
         for _ in range(num_samples):
             assert faker.paragraph(0) == ''