Skip to content

Commit

Permalink
Upgrade some outdated code constructs
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer committed Apr 3, 2023
1 parent e554eef commit b2fb177
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion autoslug/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from django.conf import settings
from django import VERSION

from django.core.urlresolvers import get_callable
from django.urls import get_callable

# use custom slugifying function if any
slugify_function_path = getattr(settings, 'AUTOSLUG_SLUGIFY_FUNCTION', 'autoslug.utils.slugify')
Expand Down
10 changes: 5 additions & 5 deletions autoslug/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,31 +275,31 @@ def test_crop_with_trailing_dash(self):
a = ModelWithLongName(name=long_name)
a.save()
assert len(a.slug) == 49 # slug cropped, last char removed
assert a.slug[-4:] == u'xxxx' # dash removed
assert a.slug[-4:] == 'xxxx' # dash removed

long_name = 'xxxx-' * 20
a = ModelWithLongName(name=long_name)
a.save()
assert len(a.slug) == 49 # slug cropped, last char removed
assert a.slug[-4:] == u'xxxx' # dash removed
assert a.slug[-4:] == 'xxxx' # dash removed

long_name = 'xxxx_' * 20
a = ModelWithLongName(name=long_name)
a.save()
assert len(a.slug) == 49 # slug cropped, last char removed
assert a.slug[-4:] == u'xxxx' # underscore removed
assert a.slug[-4:] == 'xxxx' # underscore removed

def test_crop_with_trailing_dash_unique(self):
long_name = 'xxxx ' * 20
a = ModelWithLongNameUnique(name=long_name)
a.save()
assert len(a.slug) == 49 # slug cropped, last char removed
assert a.slug[-4:] == u'xxxx' # dash removed
assert a.slug[-4:] == 'xxxx' # dash removed

b = ModelWithLongNameUnique(name=long_name)
b.save()
assert len(b.slug) == 50 # slug cropped
assert b.slug[-4:] == u'xx-2' # unique without dash
assert b.slug[-4:] == 'xx-2' # unique without dash


class AutoSlugModelTranslationTestCase(TestCase):
Expand Down

0 comments on commit b2fb177

Please sign in to comment.