Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #21517 -- Added unit test for non-autoincrement primary key wit…

…h value 0.
  • Loading branch information...
commit d1df395f3ae768e495a105db2f85352c44ba1c28 1 parent 077af42
@vajrasky vajrasky authored timgraham committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 tests/custom_pk/tests.py
View
7 tests/custom_pk/tests.py
@@ -153,6 +153,13 @@ def test_unique_pk(self):
with transaction.atomic():
Employee.objects.create(employee_code=123, first_name="Fred", last_name="Jones")
+ def test_zero_non_autoincrement_pk(self):
+ Employee.objects.create(
+ employee_code=0, first_name="Frank", last_name="Jones"
+ )
+ employee = Employee.objects.get(pk=0)
+ self.assertEqual(employee.employee_code, 0)
+
def test_custom_field_pk(self):
# Regression for #10785 -- Custom fields can be used for primary keys.
new_bar = Bar.objects.create()
Please sign in to comment.
Something went wrong with that request. Please try again.