Skip to content

Commit

Permalink
Fix tests and compatibility with Django 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jpic committed Jan 9, 2024
1 parent d45c294 commit 3f2880a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]
addopts = --nomigrations --create-db --reuse-db
DJANGO_SETTINGS_MODULE=settings.base
django_debug_mode=true
2 changes: 1 addition & 1 deletion src/dal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_result_label(self, result):
if self.template:
return render_to_string(self.template, {"result": result})
else:
return result
return str(result)

def get_selected_result_label(self, result):
"""Return the label of a selected result."""
Expand Down
5 changes: 3 additions & 2 deletions test_project/select2_list/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def test_init(self):
def test_init_lists(self):
field = autocomplete.Select2ListChoiceField(
choice_list=self.choice_list_lists)
self.assertCountEqual(field.choices, self.choice_list_lists)
# choices are converted to tuples, not a big deal
assert [*field.choices] == self.choice_list_tuples

field = autocomplete.Select2ListChoiceField(
choice_list=self.get_choice_list_lists)
self.assertCountEqual(field.choices, self.choice_list_lists)
assert [*field.choices] == self.choice_list_tuples

def test_init_tuples(self):
field = autocomplete.Select2ListChoiceField(
Expand Down
1 change: 1 addition & 0 deletions test_project/select2_taggit/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_initial(self):
(str(tag), str(tag)),
),
attrs={
'aria-describedby': 'id_test_helptext',
'data-autocomplete-light-function': 'select2',
'data-autocomplete-light-url': reverse(self.url_name),
'data-autocomplete-light-language': 'en',
Expand Down

0 comments on commit 3f2880a

Please sign in to comment.