In case when you have all router with lowercase letters.... and we add some router called "urlscraper", + uppercase tag like "URLScraper", this will cause inconsistrance between routers and tags arrays which cause mismatch between route and file name (generated based on tags names).
Python sorted tags in lexicographical (alphabetical) order, 'U', will comes before the lowercase letters and become on first element in the array.
In case of routes you using lower() function for tags and that cause inconsistence.
routers = sorted(
[re.sub(TITLE_PATTERN, '_', tag.strip()).lower() for tag in sorted_tags]
)
In case when you have all router with lowercase letters.... and we add some router called "urlscraper", + uppercase tag like "URLScraper", this will cause inconsistrance between routers and tags arrays which cause mismatch between route and file name (generated based on tags names). Python sorted tags in lexicographical (alphabetical) order, 'U', will comes before the lowercase letters and become on first element in the array. In case of routes you using lower() function for tags and that cause inconsistence.
fix:
then both arrays (routers and _sortedtags) will be sorted in sam way.