Ticket #24615: ticket_24615.diff

File ticket_24615.diff, 1.7 KB (added by Miroslav Shubernetskiy, 9 years ago)

reproduction test case

  • new file tests/ticket_24615/__init__.py

    diff --git a/tests/ticket_24615/__init__.py b/tests/ticket_24615/__init__.py
    new file mode 100644
    index 0000000..8f4a3fc
    - +  
     1# -*- coding: utf-8 -*-
     2from __future__ import print_function, unicode_literals
  • new file tests/ticket_24615/models.py

    diff --git a/tests/ticket_24615/models.py b/tests/ticket_24615/models.py
    new file mode 100644
    index 0000000..30b63f7
    - +  
     1# -*- coding: utf-8 -*-
     2from __future__ import print_function, unicode_literals
     3from django.contrib.gis.db import models
     4
     5
     6class SouthTexasCity(models.Model):
     7    "City model on projected coordinate system for South Texas."
     8    name = models.CharField(max_length=30)
     9    point = models.PointField(srid=32140)
     10
     11    objects = models.GeoManager()
  • new file tests/ticket_24615/tests.py

    diff --git a/tests/ticket_24615/tests.py b/tests/ticket_24615/tests.py
    new file mode 100644
    index 0000000..d9707cb
    - +  
     1from __future__ import unicode_literals
     2
     3from unittest import skipUnless
     4
     5from django.contrib.gis.geos import HAS_GEOS
     6# from django.contrib.gis.tests.utils import (
     7#     HAS_SPATIAL_DB, mysql
     8# )
     9from django.test import TestCase
     10
     11from django.contrib.gis.geos import Point
     12
     13from .models import SouthTexasCity
     14
     15
     16class DistanceTest(TestCase):
     17    def test_distance_with_values_list(self):
     18        """
     19        Test that distance() works in conjunction with values_list.
     20        """
     21        qs = SouthTexasCity.objects.all().distance(Point(3, 3)).order_by('distance')
     22        self.assertIsInstance(list(qs), list)
     23        self.assertIsInstance(list(qs.values_list('point', flat=True)), list)
     24        self.assertIsInstance(list(qs.values_list('name', flat=True)), list)
Back to Top