Made an `AutoField` test more robust.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
93a581431a
commit
d3cd9c0d06
|
@ -93,11 +93,13 @@ class GenericIPAddrUnpackUniqueTest(models.Model):
|
||||||
generic_v4unpack_ip = models.GenericIPAddressField(blank=True, unique=True, unpack_ipv4=True)
|
generic_v4unpack_ip = models.GenericIPAddressField(blank=True, unique=True, unpack_ipv4=True)
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
# A model can't have multiple AutoFields
|
# A model can't have multiple AutoFields
|
||||||
# Refs #12467.
|
# Refs #12467.
|
||||||
|
assertion_error = None
|
||||||
|
try:
|
||||||
class MultipleAutoFields(models.Model):
|
class MultipleAutoFields(models.Model):
|
||||||
auto1 = models.AutoField(primary_key=True)
|
auto1 = models.AutoField(primary_key=True)
|
||||||
auto2 = models.AutoField(primary_key=True)
|
auto2 = models.AutoField(primary_key=True)
|
||||||
except AssertionError, e:
|
except AssertionError, assertion_error:
|
||||||
assert e.message == u"A model can't have more than one AutoField."
|
pass # Fail silently
|
||||||
|
assert assertion_error.message == u"A model can't have more than one AutoField."
|
Loading…
Reference in New Issue