File: 0003-Fix-tests-to-work-with-local-XML-data-from-iso-codes.patch

package info (click to toggle)
django-countries 7.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,300 kB
  • sloc: python: 3,226; sh: 27; makefile: 17
file content (47 lines) | stat: -rw-r--r-- 2,272 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sun, 1 Apr 2018 10:52:56 +0200
Subject: Fix tests to work with local XML data from iso-codes package.

---
 django_countries/tests/test_countries.py | 6 ++++--
 django_countries/tests/test_fields.py    | 7 +------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/django_countries/tests/test_countries.py b/django_countries/tests/test_countries.py
index 0a6972d..153c7e2 100644
--- a/django_countries/tests/test_countries.py
+++ b/django_countries/tests/test_countries.py
@@ -197,8 +197,10 @@ class TestCountriesObject(BaseTest):
         self.assertEqual(code, "CZ")
 
     def test_fetch_by_name_i18n(self):
-        code = countries.by_name("Estados Unidos", language="es")
-        self.assertEqual(code, "US")
+        #code = countries.by_name("Estados Unidos", language="es")
+        #self.assertEqual(code, "US")
+        code = countries.by_name('Finlandia', language='es')
+        self.assertEqual(code, 'FI')
 
     def test_fetch_by_name_no_match(self):
         self.assertEqual(countries.by_name("Neverland"), "")
diff --git a/django_countries/tests/test_fields.py b/django_countries/tests/test_fields.py
index 2396e1b..f07401b 100644
--- a/django_countries/tests/test_fields.py
+++ b/django_countries/tests/test_fields.py
@@ -264,15 +264,10 @@ class TestCountryField(TestCase):
 
     def test_by_country_name_endswith(self):
         p = Person.objects.create(name="A", country="AS")  # American Samoa
-        pp = Person.objects.create(name="A", country="US")  # United States of America
         self.assertEqual(
-            set(Person.objects.filter(country__contains="America")), {p, pp}
+            set(Person.objects.filter(country__contains="America")), {p,}
         )
-        self.assertEqual(list(Person.objects.filter(country__endswith="America")), [pp])
         self.assertEqual(list(Person.objects.filter(country__endswith="america")), [])
-        self.assertEqual(
-            list(Person.objects.filter(country__iendswith="america")), [pp]
-        )
         # No longer works with codes.
         self.assertEqual(list(Person.objects.filter(country__endswith="US")), [])
         self.assertEqual(list(Person.objects.filter(country__iendswith="us")), [])