diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-12-29 16:27:49 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 20:18:46 +0100 |
| commit | 7b2f2e74adb36a4334e83130f6abc2f79d395235 (patch) | |
| tree | 313387ba6a6f1311b43cf5fb4f2576d2d6c4f805 /tests/gis_tests | |
| parent | f6acd1d271122d66de8061e75ae26137ddf02658 (diff) | |
Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
Diffstat (limited to 'tests/gis_tests')
| -rw-r--r-- | tests/gis_tests/geoadmin/tests.py | 2 | ||||
| -rw-r--r-- | tests/gis_tests/geoapp/test_functions.py | 3 | ||||
| -rw-r--r-- | tests/gis_tests/geos_tests/test_geos.py | 13 | ||||
| -rw-r--r-- | tests/gis_tests/geos_tests/test_io.py | 3 | ||||
| -rw-r--r-- | tests/gis_tests/geos_tests/test_mutable_list.py | 3 | ||||
| -rw-r--r-- | tests/gis_tests/test_geoforms.py | 2 | ||||
| -rw-r--r-- | tests/gis_tests/test_geoip2.py | 3 |
7 files changed, 12 insertions, 17 deletions
diff --git a/tests/gis_tests/geoadmin/tests.py b/tests/gis_tests/geoadmin/tests.py index 23fa8071b3..96877c26e3 100644 --- a/tests/gis_tests/geoadmin/tests.py +++ b/tests/gis_tests/geoadmin/tests.py @@ -96,6 +96,6 @@ class GeoAdminTest(TestCase): self.assertEqual(len(logger_calls), 1) self.assertEqual( logger_calls[0], - "Error creating geometry from value 'INVALID()' (String or unicode input " + "Error creating geometry from value 'INVALID()' (String input " "unrecognized as WKT EWKT, and HEXEWKB.)" ) diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py index 2767b7974b..4d3913a7a3 100644 --- a/tests/gis_tests/geoapp/test_functions.py +++ b/tests/gis_tests/geoapp/test_functions.py @@ -7,7 +7,6 @@ from django.contrib.gis.measure import Area from django.db import connection from django.db.models import Sum from django.test import TestCase, skipUnlessDBFeature -from django.utils import six from ..utils import mysql, oracle, postgis, spatialite from .models import City, Country, CountryWebMercator, State, Track @@ -361,7 +360,7 @@ class GISFunctionsTests(TestCase): for bad_args in ((), range(3), range(5)): with self.assertRaises(ValueError): Country.objects.annotate(snap=functions.SnapToGrid('mpoly', *bad_args)) - for bad_args in (('1.0',), (1.0, None), tuple(map(six.text_type, range(4)))): + for bad_args in (('1.0',), (1.0, None), tuple(map(str, range(4)))): with self.assertRaises(TypeError): Country.objects.annotate(snap=functions.SnapToGrid('mpoly', *bad_args)) diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py index ff28eebf0f..7877e1f2d6 100644 --- a/tests/gis_tests/geos_tests/test_geos.py +++ b/tests/gis_tests/geos_tests/test_geos.py @@ -17,7 +17,6 @@ from django.contrib.gis.shortcuts import numpy from django.template import Context from django.template.engine import Engine from django.test import SimpleTestCase, mock -from django.utils import six from django.utils.encoding import force_bytes from django.utils.six.moves import range @@ -65,8 +64,8 @@ class GEOSTest(SimpleTestCase, TestDataMixin): self.assertIs(GEOSGeometry(hexewkb_3d).hasz, True) # Same for EWKB. - self.assertEqual(six.memoryview(a2b_hex(hexewkb_2d)), pnt_2d.ewkb) - self.assertEqual(six.memoryview(a2b_hex(hexewkb_3d)), pnt_3d.ewkb) + self.assertEqual(memoryview(a2b_hex(hexewkb_2d)), pnt_2d.ewkb) + self.assertEqual(memoryview(a2b_hex(hexewkb_3d)), pnt_3d.ewkb) # Redundant sanity check. self.assertEqual(4326, GEOSGeometry(hexewkb_2d).srid) @@ -88,7 +87,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): # Bad WKB with self.assertRaises(GEOSException): - GEOSGeometry(six.memoryview(b'0')) + GEOSGeometry(memoryview(b'0')) class NotAGeometry(object): pass @@ -118,7 +117,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin): def test_create_wkb(self): "Testing creation from WKB." for g in self.geometries.hex_wkt: - wkb = six.memoryview(a2b_hex(g.hex.encode())) + wkb = memoryview(a2b_hex(g.hex.encode())) geom_h = GEOSGeometry(wkb) # we need to do this so decimal places get normalized geom_t = fromstr(g.wkt) @@ -1164,13 +1163,13 @@ class GEOSTest(SimpleTestCase, TestDataMixin): g = GEOSGeometry("POINT(0 0)") self.assertTrue(g.valid) - self.assertIsInstance(g.valid_reason, six.string_types) + self.assertIsInstance(g.valid_reason, str) self.assertEqual(g.valid_reason, "Valid Geometry") g = GEOSGeometry("LINESTRING(0 0, 0 0)") self.assertFalse(g.valid) - self.assertIsInstance(g.valid_reason, six.string_types) + self.assertIsInstance(g.valid_reason, str) self.assertTrue(g.valid_reason.startswith("Too few points in geometry component")) def test_linearref(self): diff --git a/tests/gis_tests/geos_tests/test_io.py b/tests/gis_tests/geos_tests/test_io.py index 81e0ff357f..98b2aba3b4 100644 --- a/tests/gis_tests/geos_tests/test_io.py +++ b/tests/gis_tests/geos_tests/test_io.py @@ -6,7 +6,6 @@ from django.contrib.gis.geos import ( WKTWriter, ) from django.test import SimpleTestCase -from django.utils.six import memoryview @skipUnless(HAS_GEOS, "Geos is required.") @@ -25,7 +24,7 @@ class GEOSIOTest(SimpleTestCase): for geom in (g1, g2): self.assertEqual(ref, geom) - # Should only accept six.string_types objects. + # Should only accept string objects. with self.assertRaises(TypeError): wkt_r.read(1) with self.assertRaises(TypeError): diff --git a/tests/gis_tests/geos_tests/test_mutable_list.py b/tests/gis_tests/geos_tests/test_mutable_list.py index 3f7d8c30a1..26bdeb8045 100644 --- a/tests/gis_tests/geos_tests/test_mutable_list.py +++ b/tests/gis_tests/geos_tests/test_mutable_list.py @@ -7,7 +7,6 @@ import unittest from django.contrib.gis.geos.mutable_list import ListMixin -from django.utils import six class UserListA(ListMixin): @@ -298,7 +297,7 @@ class ListMixinTest(unittest.TestCase): def test07_allowed_types(self): 'Type-restricted list' pl, ul = self.lists_of_len() - ul._allowed = six.integer_types + ul._allowed = int ul[1] = 50 ul[:2] = [60, 70, 80] diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py index 27b80ce9b2..6fe0996721 100644 --- a/tests/gis_tests/test_geoforms.py +++ b/tests/gis_tests/test_geoforms.py @@ -132,7 +132,7 @@ class GeometryFieldTest(SimpleTestCase): self.assertEqual(len(logger_calls), 1) self.assertEqual( logger_calls[0], - "Error creating geometry from value 'PNT(0)' (String or unicode input " + "Error creating geometry from value 'PNT(0)' (String input " "unrecognized as WKT EWKT, and HEXEWKB.)" ) diff --git a/tests/gis_tests/test_geoip2.py b/tests/gis_tests/test_geoip2.py index 54f20412a4..d35dcc336e 100644 --- a/tests/gis_tests/test_geoip2.py +++ b/tests/gis_tests/test_geoip2.py @@ -6,7 +6,6 @@ from django.conf import settings from django.contrib.gis.geoip2 import HAS_GEOIP2 from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry from django.test import mock -from django.utils import six if HAS_GEOIP2: from django.contrib.gis.geoip2 import GeoIP2, GeoIP2Exception @@ -48,7 +47,7 @@ class GeoIPTest(unittest.TestCase): for bad in bad_params: with self.assertRaises(GeoIP2Exception): GeoIP2(cache=bad) - if isinstance(bad, six.string_types): + if isinstance(bad, str): e = GeoIP2Exception else: e = TypeError |
