def test_functions_only(self):
        """Accessing non-functions through the `.optional` attribute
        will throw a TypeError."""

        fake = Faker()

        with pytest.raises(TypeError, match="Accessing non-functions through .optional is not supported."):
            fake.optional.locales
Accessing non-functions through the `.optional` attribute
        will throw a TypeError.
tests/test_optional.py