graphql-python / graphql-python/graphene-django
Cannot create enum dynamically with f-string
Open
🐛bug
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
* **What is the current behavior?**
This does not work.
```
distances_km = [1, 2, 5, 10, 20, 40, 60, 80, 100, 250, 500]
distances_with_enum_labels = [
(f'kilometre_{d}', d)
for d in distances_km
]
DistanceWithin = graphene.Enum(
'Distance Within', [(d for d in distances_with_enum_labels])
```
Error - AssertionError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "Distance Within" does not
* **What is the expected behavior?**
It should allow this.
Contributor guide
Assessment
This issue has not been assessed yet.