-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#302 Slugify tags with theirs groups #304
Conversation
catalog/models.py
Outdated
@@ -401,7 +426,7 @@ class Meta: | |||
def __str__(self): | |||
return self.name | |||
|
|||
def _slugify(self) -> None: | |||
def _get_slug(self) -> str: | |||
"""Make a slug from the name.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is about implementation, that is changing, so let's remove it
def test_slugify_conflicts(self): | ||
slugs = [ | ||
catalog_models.MockTag.objects.create(name=name).slug | ||
for name in ['11 A', '1/1 A', '1 1 A'] | ||
for name in ['11 A', '1/1 A', '1 1 A', '1.1 A', '1-1 A', '1_1 A'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create a separate skipped test (e.g. test_slugify_punctuation_conflicts
) for the set, that led to the conflict to preserve testing of the set that has no such conflicts 11 A, 1/1 A, 1 1 A
This will help to avoid regressions if we break the slugify for non-conflict set. In common i'd prefer stick to such rule: new tests for new bugs. Up to you
|
||
self.assertEqual(len(slugs), len(set(slugs)), msg=slugs) | ||
|
||
def test_slugs_for_cloned_tag_values(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_slugs_for_cloned_tag_values(self): | |
def test_cloned_tag_varied_group_slugs(self): |
Up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll leave it because of few points:
- i want to leave
test_slugs_
at the beginning - tag values are the same. It's not very common situation, so it's the corner case. That's the point of test problem
- y, groups varying, but it's a normal situation
Closes #302