Commits

adamv committed 87bb820

Splitting apart test_main.myapp into separate test apps.

  • Participants
  • Parent commits 73d1f84

Comments (0)

Files changed (7)

File source/sqlserver_ado/query.py

                 qn = self.connection.ops.quote_name
                 order = '%s.%s ASC' % (qn(meta.db_table), qn(meta.pk.attname))
             
-            where_row_num = "%s < _row_num" % (self.low_mark)
+            where_row_num = "%s <= _row_num" % (self.low_mark)
             if self.high_mark:
-                where_row_num += " and _row_num <= %s" % (self.high_mark)
+                where_row_num += " and _row_num < %s" % (self.high_mark)
                 
             outer_select, inner_select = self._alias_columns(inner_select)
             

File tests/test_main/myapp/models.py

 import decimal
 from django.db import models
 
-class BaseModel(models.Model):
-    def __unicode__(self):
-        return u'id: ' + unicode(self.id) + ' Amount: ' + unicode(self.val)
-
-    class Meta:
-        abstract = True
-
-
-class TableNullChar(BaseModel):
-    """
-    >>> obj = TableNullChar(val=None)
-    >>> obj.save()
-    >>> obj = TableNullChar(val="This is my string value.")
-    >>> obj.save()
-    >>> len(list(TableNullChar.objects.all()))
-    2
-    """
-    val = models.CharField(null=True, max_length=100)
-    
-class TableNullText(BaseModel):
-    """
-    >>> obj = TableNullText(val=None)
-    >>> obj.save()
-    >>> obj = TableNullText(val="This is my string value.")
-    >>> obj.save()
-    >>> len(list(TableNullText.objects.all()))
-    2
-    """
-    val = models.TextField(null=True)
-
-class TableNullInteger(BaseModel):
-    """
-    >>> obj = TableNullInteger(val=None)
-    >>> obj.save()
-    >>> obj = TableNullInteger(val=39482)
-    >>> obj.save()
-    >>> len(list(TableNullInteger.objects.all()))
-    2
-    """
-    val = models.IntegerField(null=True)
-
-class TableNullDateTime(BaseModel):
-    """
-    >>> obj = TableNullDateTime(val=None)
-    >>> obj.save()
-    >>> obj = TableNullDateTime(val=datetime.datetime(2009,1,1,4,3,5))
-    >>> obj.save()
-    >>> len(list(TableNullDateTime.objects.all()))
-    2
-    """
-    val = models.DateTimeField(null=True)
-
-class TableNullDate(BaseModel):
-    """
-    >>> obj = TableNullDate(val=None)
-    >>> obj.save()
-    >>> obj = TableNullDate(val=datetime.date(2009,1,1))
-    >>> obj.save()
-    >>> len(list(TableNullDate.objects.all()))
-    2
-    """
-    val = models.DateField(null=True)
-
-class TableNullTime(BaseModel):
-    """
-    This test isn't expected to work on SQL Server 2005,
-    as there is no bare "time" type.
-    
-    obj = TableNullTime(val=None)
-    obj.save()
-    obj = TableNullTime(val=datetime.time(2,34,2))
-    obj.save()
-    len(list(TableNullTime.objects.all()))
-    2
-    """
-    val = models.TimeField(null=True)
-
-class TableNullBoolean(BaseModel):
-    """
-    >>> obj = TableNullBoolean(val=None)
-    >>> obj.save()
-    >>> obj = TableNullBoolean(val=True)
-    >>> obj.save()
-    >>> obj = TableNullBoolean(val=False)
-    >>> obj.save()
-    >>> len(list(TableNullBoolean.objects.all()))
-    3
-    """
-    val = models.BooleanField(null=True)
-
-class TableNullNullBoolean(BaseModel):
-    """
-    >>> obj = TableNullNullBoolean(val=None)
-    >>> obj.save()
-    >>> obj = TableNullNullBoolean(val=True)
-    >>> obj.save()
-    >>> obj = TableNullNullBoolean(val=False)
-    >>> obj.save()
-    >>> len(list(TableNullNullBoolean.objects.all()))
-    3
-    """
-    val = models.NullBooleanField(null=True)
-
-class TableNullDecimal(BaseModel):
-    """
-    >>> obj = TableNullDecimal(val=None)
-    >>> obj.save()
-    
-    Try a value at the top end of the specified precision/scale
-    >>> obj = TableNullDecimal(val=decimal.Decimal('99.99'))
-    >>> obj.save()
-    
-    >>> len(list(TableNullDecimal.objects.all()))
-    2
-    """
-    val = models.DecimalField(null=True, max_digits=4, decimal_places=2)
-
-class TableNullFloat(BaseModel):
-    """
-    >>> obj = TableNullFloat(val=None)
-    >>> obj.save()
-    >>> obj = TableNullFloat(val=34.3)
-    >>> obj.save()
-    >>> len(list(TableNullFloat.objects.all()))
-    2
-    """
-    val = models.FloatField(null=True)
-
+import unittest
 
 class Bug19Table(models.Model):
     """ A simple model for testing string comparisons.
     a = models.IntegerField()
 
 
+# Test slicing
 class Products(models.Model):
     """
     >>> names=['Screws', 'Bolts', 'Nuts', 'S-Pipe', 'L-Pipe', 'Item', 'Zebra']
     3
     >>> len(list(p.all()[5:]))
     3
-    >>> len(list(p.order_by('name')))
-    7
-    >>> len(list(p.order_by('name')[:3]))
-    3
-    >>> len(list(p.order_by('name')[2:5]))
-    3
-    >>> len(list(p.order_by('name')[5:]))
-    3
+    >>> list(p.order_by('name'))
+    [Bolts, Item, L-Pipe, Nuts, Screws, S-Pipe, Zebra]
+    >>> list(p.order_by('name')[:3])
+    [Bolts, Item, L-Pipe]
+    >>> list(p.order_by('name')[2:5])
+    [Item, L-Pipe, Nuts]
+    >>> list(p.order_by('name')[5:])
+    [Screws, S-Pipe, Zebra]
     """
 
     productid = models.AutoField(primary_key=True)
     name = models.CharField(max_length=50)
         
     def __repr__(self):
-        return "<Product %s: %s>" % (self.productid, self.name)
+        return self.name
         
     def __unicode__(self):
-        return u"<Product %s: %s>" % (self.productid, self.name)
-
+        return "<Product %u: %u>" % (self.productid, self.name)
 
 
 class RelatedB(models.Model):
     """
     a = models.CharField(max_length=50)
     b = models.ForeignKey(RelatedB)
-

File tests/test_main/nulls/__init__.py

Empty file added.

File tests/test_main/nulls/models.py

+import datetime
+import decimal
+from django.db import models
+
+class BaseModel(models.Model):
+    def __unicode__(self):
+        return u'id: ' + unicode(self.id) + ' Amount: ' + unicode(self.val)
+
+    class Meta:
+        abstract = True
+
+
+class TableNullChar(BaseModel):
+    """
+    >>> obj = TableNullChar(val=None)
+    >>> obj.save()
+    >>> obj = TableNullChar(val="This is my string value.")
+    >>> obj.save()
+    >>> len(list(TableNullChar.objects.all()))
+    2
+    """
+    val = models.CharField(null=True, max_length=100)
+    
+class TableNullText(BaseModel):
+    """
+    >>> obj = TableNullText(val=None)
+    >>> obj.save()
+    >>> obj = TableNullText(val="This is my string value.")
+    >>> obj.save()
+    >>> len(list(TableNullText.objects.all()))
+    2
+    """
+    val = models.TextField(null=True)
+
+class TableNullInteger(BaseModel):
+    """
+    >>> obj = TableNullInteger(val=None)
+    >>> obj.save()
+    >>> obj = TableNullInteger(val=39482)
+    >>> obj.save()
+    >>> len(list(TableNullInteger.objects.all()))
+    2
+    """
+    val = models.IntegerField(null=True)
+
+class TableNullDateTime(BaseModel):
+    """
+    >>> obj = TableNullDateTime(val=None)
+    >>> obj.save()
+    >>> obj = TableNullDateTime(val=datetime.datetime(2009,1,1,4,3,5))
+    >>> obj.save()
+    >>> len(list(TableNullDateTime.objects.all()))
+    2
+    """
+    val = models.DateTimeField(null=True)
+
+class TableNullDate(BaseModel):
+    """
+    >>> obj = TableNullDate(val=None)
+    >>> obj.save()
+    >>> obj = TableNullDate(val=datetime.date(2009,1,1))
+    >>> obj.save()
+    >>> len(list(TableNullDate.objects.all()))
+    2
+    """
+    val = models.DateField(null=True)
+
+class TableNullTime(BaseModel):
+    """
+    This test isn't expected to work on SQL Server 2005,
+    as there is no bare "time" type.
+    
+    obj = TableNullTime(val=None)
+    obj.save()
+    obj = TableNullTime(val=datetime.time(2,34,2))
+    obj.save()
+    len(list(TableNullTime.objects.all()))
+    2
+    """
+    val = models.TimeField(null=True)
+
+class TableNullBoolean(BaseModel):
+    """
+    >>> obj = TableNullBoolean(val=None)
+    >>> obj.save()
+    >>> obj = TableNullBoolean(val=True)
+    >>> obj.save()
+    >>> obj = TableNullBoolean(val=False)
+    >>> obj.save()
+    >>> len(list(TableNullBoolean.objects.all()))
+    3
+    """
+    val = models.BooleanField(null=True)
+
+class TableNullNullBoolean(BaseModel):
+    """
+    >>> obj = TableNullNullBoolean(val=None)
+    >>> obj.save()
+    >>> obj = TableNullNullBoolean(val=True)
+    >>> obj.save()
+    >>> obj = TableNullNullBoolean(val=False)
+    >>> obj.save()
+    >>> len(list(TableNullNullBoolean.objects.all()))
+    3
+    """
+    val = models.NullBooleanField(null=True)
+
+class TableNullDecimal(BaseModel):
+    """
+    >>> obj = TableNullDecimal(val=None)
+    >>> obj.save()
+    
+    Try a value at the top end of the specified precision/scale
+    >>> obj = TableNullDecimal(val=decimal.Decimal('99.99'))
+    >>> obj.save()
+    
+    >>> len(list(TableNullDecimal.objects.all()))
+    2
+    """
+    val = models.DecimalField(null=True, max_digits=4, decimal_places=2)
+
+class TableNullFloat(BaseModel):
+    """
+    >>> obj = TableNullFloat(val=None)
+    >>> obj.save()
+    >>> obj = TableNullFloat(val=34.3)
+    >>> obj.save()
+    >>> len(list(TableNullFloat.objects.all()))
+    2
+    """
+    val = models.FloatField(null=True)

File tests/test_main/nulls/views.py

+# Create your views here.

File tests/test_main/paging/models.py

-import unittest
 from django.db import models
 from django.core.paginator import QuerySetPaginator
 
+import unittest
+
 class FirstTable(models.Model):
     b = models.CharField(max_length=100)
     # Add a reserved word column; this will get quoted correctly

File tests/test_main/settings.py

 )
 
 INSTALLED_APPS = (
+    'nulls',
+	'paging',
 	'myapp',
-	'paging',
 )