Anonymous avatar Anonymous committed adcc363

* Additional null column tests.

Comments (0)

Files changed (5)

src/sqlserver_ado/creation.py

     'SlugField':         'nvarchar(%(max_length)s)',
     'SmallIntegerField': 'smallint',
     'TextField':         'nvarchar(max)', # SQL Server 2005 and up!
-    'TimeField':         'time',
+    'TimeField':         'datetime',
     'USStateField':      'nchar(2)',
 }

tests/test_bug_009/dump_all.py

 from myapp.models import *
 
-print list(TableNullText.objects.all())
-print list(TableNullInteger.objects.all())
-print list(TableNullDate.objects.all())
+for klass in (TableNullText, TableNullInteger, TableNullDateTime, TableNullDate, TableNullTime, TableNullBoolean, TableNullDecimal):
+	print list(klass.objects.all())

tests/test_bug_009/insert_null.py

 from myapp.models import *
-obj1 = TableNullText(amount=None)
-obj1.save()
 
-obj2 = TableNullInteger(amount=None)
-obj2.save()
-
-obj3 = TableNullDate(amount=None)
-obj3.save()
+for klass in (TableNullText, TableNullInteger, TableNullDateTime, TableNullDate, TableNullTime, TableNullBoolean, TableNullDecimal):
+	obj = klass(amount=None)
+	obj.save()

tests/test_bug_009/insert_nulls.py

-from myapp.models import *
-obj1 = SomeTable(amount=47)
-obj1.save()
-
-obj2 = SomeTable(amount=None)
-obj2.save()

tests/test_bug_009/myapp/models.py

 	def __unicode__(self):
 		return u'Amount: ' + unicode(self.amount)
 
-class TableNullDate(models.Model):
+class TableNullDateTime(models.Model):
 	amount = models.DateTimeField(null=True)
 	
 	def __unicode__(self):
 		return u'Amount: ' + unicode(self.amount)
+		
+class TableNullDate(models.Model):
+	amount = models.DateField(null=True)
+	
+	def __unicode__(self):
+		return u'Amount: ' + unicode(self.amount)
+		
+class TableNullTime(models.Model):
+	amount = models.TimeField(null=True)
+	
+	def __unicode__(self):
+		return u'Amount: ' + unicode(self.amount)
+		
+class TableNullBoolean(models.Model):
+	amount = models.BooleanField(null=True)
+	
+	def __unicode__(self):
+		return u'Amount: ' + unicode(self.amount)
+
+class TableNullDecimal(models.Model):
+	amount = models.DecimalField(null=True, max_digits=4, decimal_places=2)
+	
+	def __unicode__(self):
+		return u'Amount: ' + unicode(self.amount)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.