def test_primary_key_unique_check_performed_when_adding_and_pk_specified(self): # Regression test for #12560 query_count = len(connection.queries) mtv = ModelToValidate(number=10, name='Some Name', id=123) setattr(mtv, '_adding', True) mtv.full_clean() self.assertEqual(query_count + 1, len(connection.queries))
def test(): mtv = ModelToValidate(number=10, name='Some Name') mtv.full_clean()
def test(): mtv = ModelToValidate(number=10, name='Some Name', id=123) setattr(mtv, '_adding', True) mtv.full_clean()
def test_primary_key_unique_check_not_performed_when_not_adding(self): # Regression test for #12132 query_count= len(connection.queries) mtv = ModelToValidate(number=10, name='Some Name') mtv.full_clean() self.assertEqual(query_count, len(connection.queries))
def test(): mtv = ModelToValidate(number=10, name="Some Name", id=123) setattr(mtv, "_adding", True) mtv.full_clean()
def test_primary_key_unique_check_not_performed_when_not_adding(self): # Regression test for #12132 query_count = len(connection.queries) mtv = ModelToValidate(number=10, name='Some Name') mtv.full_clean() self.assertEqual(query_count, len(connection.queries))