From 278b6187d2a6711afb0b35dc5c3c09fe5be9adb3 Mon Sep 17 00:00:00 2001
From: Tom Carrick <tom@carrick.eu>
Date: Fri, 18 Sep 2020 12:12:27 +0200
Subject: [PATCH] Refs #21181 -- Corrected DatabaseFeatures.test_collations for
 Swedish collation.

Previously, backends used different keys "swedish-ci" or "swedish_ci".
---
 django/db/backends/base/features.py           | 2 +-
 django/db/backends/mysql/features.py          | 2 +-
 django/db/backends/postgresql/features.py     | 2 +-
 tests/db_functions/comparison/test_collate.py | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
index e042260810..3aa0577866 100644
--- a/django/db/backends/base/features.py
+++ b/django/db/backends/base/features.py
@@ -306,7 +306,7 @@ class BaseDatabaseFeatures:
     test_collations = {
         'ci': None,  # Case-insensitive.
         'cs': None,  # Case-sensitive.
-        'swedish-ci': None  # Swedish case-insensitive.
+        'swedish_ci': None  # Swedish case-insensitive.
     }
 
     def __init__(self, connection):
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py
index b0bf4fd763..e97b3bfaa4 100644
--- a/django/db/backends/mysql/features.py
+++ b/django/db/backends/mysql/features.py
@@ -46,7 +46,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     order_by_nulls_first = True
     test_collations = {
         'ci': 'utf8_general_ci',
-        'swedish-ci': 'utf8_swedish_ci',
+        'swedish_ci': 'utf8_swedish_ci',
     }
 
     @cached_property
diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py
index 67ccd14690..9080e75a36 100644
--- a/django/db/backends/postgresql/features.py
+++ b/django/db/backends/postgresql/features.py
@@ -59,7 +59,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
     has_json_operators = True
     json_key_contains_list_matching_requires_list = True
     test_collations = {
-        'swedish-ci': 'sv-x-icu',
+        'swedish_ci': 'sv-x-icu',
     }
 
     @cached_property
diff --git a/tests/db_functions/comparison/test_collate.py b/tests/db_functions/comparison/test_collate.py
index 6507c904bc..b680ed9a05 100644
--- a/tests/db_functions/comparison/test_collate.py
+++ b/tests/db_functions/comparison/test_collate.py
@@ -31,7 +31,7 @@ class CollateTests(TestCase):
         self.assertSequenceEqual(qs, [self.author2, self.author1])
 
     def test_language_collation_order_by(self):
-        collation = connection.features.test_collations.get('swedish-ci')
+        collation = connection.features.test_collations.get('swedish_ci')
         if not collation:
             self.skipTest('This backend does not support language collations.')
         author3 = Author.objects.create(alias='O', name='Jones')