mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 08:36:32 +00:00
Removes unused dict_key filter
This commit is contained in:
parent
63172ecf00
commit
04cc2fb3f3
2 changed files with 0 additions and 13 deletions
|
@ -11,12 +11,6 @@ from bookwyrm.views.status import to_markdown
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="dict_key")
|
|
||||||
def dict_key(d, k):
|
|
||||||
"""Returns the given key from a dictionary."""
|
|
||||||
return d.get(k) or 0
|
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="rating")
|
@register.filter(name="rating")
|
||||||
def get_rating(book, user):
|
def get_rating(book, user):
|
||||||
"""get the overall rating of a book"""
|
"""get the overall rating of a book"""
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import re
|
import re
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from dateutil.relativedelta import relativedelta
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
@ -33,12 +32,6 @@ class TemplateTags(TestCase):
|
||||||
)
|
)
|
||||||
self.book = models.Edition.objects.create(title="Test Book")
|
self.book = models.Edition.objects.create(title="Test Book")
|
||||||
|
|
||||||
def test_dict_key(self, _):
|
|
||||||
"""just getting a value out of a dict"""
|
|
||||||
test_dict = {"a": 1, "b": 3}
|
|
||||||
self.assertEqual(bookwyrm_tags.dict_key(test_dict, "a"), 1)
|
|
||||||
self.assertEqual(bookwyrm_tags.dict_key(test_dict, "c"), 0)
|
|
||||||
|
|
||||||
def test_get_user_rating(self, _):
|
def test_get_user_rating(self, _):
|
||||||
"""get a user's most recent rating of a book"""
|
"""get a user's most recent rating of a book"""
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||||
|
|
Loading…
Reference in a new issue