(self)
| 576 | self.assertIs(case._is_pk_set(), True) |
| 577 | |
| 578 | def test_save_expressions(self): |
| 579 | article = Article(pub_date=Now()) |
| 580 | article.save() |
| 581 | expected_num_queries = ( |
| 582 | 0 if connection.features.can_return_columns_from_insert else 1 |
| 583 | ) |
| 584 | with self.assertNumQueries(expected_num_queries): |
| 585 | article_pub_date = article.pub_date |
| 586 | self.assertIsInstance(article_pub_date, datetime) |
| 587 | # Sleep slightly to ensure a different database level NOW(). |
| 588 | time.sleep(0.1) |
| 589 | article.pub_date = Now() |
| 590 | article.save() |
| 591 | expected_num_queries = ( |
| 592 | 0 if connection.features.can_return_rows_from_update else 1 |
| 593 | ) |
| 594 | with self.assertNumQueries(expected_num_queries): |
| 595 | self.assertIsInstance(article.pub_date, datetime) |
| 596 | self.assertGreater(article.pub_date, article_pub_date) |
| 597 | |
| 598 | |
| 599 | class ModelLookupTest(TestCase): |
nothing calls this directly
no test coverage detected