Skip to content
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

Merged
merged 5 commits into from
Mar 6, 2019
Merged

Conversation

duker33
Copy link
Collaborator

@duker33 duker33 commented Mar 6, 2019

Closes #302

@duker33 duker33 self-assigned this Mar 6, 2019
@duker33 duker33 requested a review from ArtemijRodionov March 6, 2019 12:07
@@ -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."""
Copy link
Contributor

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']
Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_slugs_for_cloned_tag_values(self):
def test_cloned_tag_varied_group_slugs(self):

Up to you

Copy link
Collaborator Author

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

@duker33 duker33 merged commit d659d42 into master Mar 6, 2019
@duker33 duker33 deleted the 302_slugify_group_names branch March 6, 2019 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants