test_common.py 文件源码

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

项目:eggsnspam 作者: wayfair 项目源码 文件源码
def test_fetchmany(self):
        """It gets many rows"""
        query = text("""
        SELECT id, name FROM tblExample
        ORDER BY id
        """)

        # Expect multiple records to be returned
        result = self.dao.fetchmany(query)
        self.assertEqual(len(result), 3)
        self.assertDictEqual(result[0], {'id': 1, 'name': 'Foo'})
        self.assertDictEqual(result[1], {'id': 2, 'name': 'Bar'})
        self.assertDictEqual(result[2], {'id': 3, 'name': 'Baz'})

        # Expect rows to be limited by MAX_RESULTS_SIZE
        self.dao.MAX_RESULTS_SIZE = 2
        result = self.dao.fetchmany(query)
        self.assertEqual(len(result), 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号