test_field.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:django-postgres-composite-types 作者: danni 项目源码 文件源码
def test_adapted_sql(self):
        """
        Check that the value is serialised to the correct SQL string, including
        a type cast
        """
        value = SimpleType(a=1, b="b", c=datetime.datetime(1985, 10, 26, 9, 0))

        adapted = adapt(value)
        adapted.prepare(connection.connection)

        self.assertEqual(
            b"(1, 'b', '1985-10-26T09:00:00'::timestamp)::test_type",
            adapted.getquoted())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号