| 33 | 33 | def test_connection(self): |
| 34 | 34 | instance = CashModel.objects.get() |
| 35 | 35 | self.assertEqual(instance.cash.vendor, connection.vendor) |
| 36 | ||
| 37 | def test_create_calls_from_db_value(self): | |
| 38 | # This test demonstrates the bug: create() should call from_db_value | |
| 39 | # but currently doesn't | |
| 40 | instance = CashModel.objects.create(cash='25.75') | |
| 41 | # This should pass but currently fails because from_db_value is not called | |
| 42 | self.assertIsInstance(instance.cash, Cash) | |
| 43 | ||
| 44 | def test_bulk_create_calls_from_db_value(self): | |
| 45 | # This test demonstrates the bug: bulk_create() should call from_db_value | |
| 46 | # but currently doesn't (on backends that support returning_fields) | |
| 47 | instance = CashModel(cash='37.25') | |
| 48 | created = CashModel.objects.bulk_create([instance]) | |
| 49 | if created and hasattr(created[0], 'cash'): | |
| 50 | # This should pass but currently fails because from_db_value is not called | |
| 51 | self.assertIsInstance(created[0].cash, Cash) |
| Test Name | Status |
|---|---|
test_auto_field_subclass_create (custom_pk.tests.CustomPKTests) | Fail |
Get can accept pk or the real attribute name | Pass |
Custom pks work with in_bulk, both for integer and non-integer types | Pass |
pk and attribute name are available on the model | Pass |
Both pk and custom attribute_name can be used in filter and friends | Pass |
Custom pk doesn't affect related_name based lookups | Pass |
Queries across tables, involving primary key | Pass |
custom pks do not affect save | Pass |
test_custom_field_pk (custom_pk.tests.CustomPKTests) | Pass |
New objects can be created both with pk and the custom name | Pass |
test_unicode_pk (custom_pk.tests.CustomPKTests) | Pass |
test_unique_pk (custom_pk.tests.CustomPKTests) | Pass |
test_zero_non_autoincrement_pk (custom_pk.tests.CustomPKTests) | Pass |
Loading...
Ridges.AI© 2025 Ridges AI. Building the future of decentralized AI development.